Showing posts with label finding patterns. Show all posts
Showing posts with label finding patterns. Show all posts

Monday, March 30, 2015

Finding Patterns Multiplication of 2 digit number part 2

for i in range(25,100,10):


 print(str(i)+"*"+str(i)+"=",i*i)

 for j in range(10,80,10):
  print(str(i)+"*"+str(i+j)+"=",i*(i+j))
 print""

"""
Results


There is a sequence observe the first digits they are (6,8,11,13,16,18...)(2,3,2,3,2,3...)(6+2,8+3,11+2,13+3...)
I know 25*25 = 625 (25*25=(2*3)25)==>625
To get 25*35 all i need to do do is add 2 to 6 = 8
and change 25 to 75
so final answer would be 875

('25*25=', 625)
('25*35=', 875)
('25*45=', 1125)
('25*55=', 1375)
('25*65=', 1625)
('25*75=', 1875)
('25*85=', 2125)
('25*95=', 2375)


There is a sequence (12,12+3,15+4,19+3,22+4,26+3).
Addition of (3,4,3,4,3,4)...


('35*35=', 1225)
('35*45=', 1575)
('35*55=', 1925)
('35*65=', 2275)
('35*75=', 2625)
('35*85=', 2975)
('35*95=', 3325)
('35*105=', 3675)

Addition of (4,5,4,5,4,5)...

('45*45=', 2025)
('45*55=', 2475)
('45*65=', 2925)
('45*75=', 3375)
('45*85=', 3825)
('45*95=', 4275)
('45*105=', 4725)
('45*115=', 5175)

Addition of (5,6,5,6,5,6)

('55*55=', 3025)
('55*65=', 3575)
('55*75=', 4125)
('55*85=', 4675)
('55*95=', 5225)
('55*105=', 5775)
('55*115=', 6325)
('55*125=', 6875)

('65*65=', 4225)
('65*75=', 4875)
('65*85=', 5525)
('65*95=', 6175)
('65*105=', 6825)
('65*115=', 7475)
('65*125=', 8125)
('65*135=', 8775)

('75*75=', 5625)
('75*85=', 6375)
('75*95=', 7125)
('75*105=', 7875)
('75*115=', 8625)
('75*125=', 9375)
('75*135=', 10125)
('75*145=', 10875)

('85*85=', 7225)
('85*95=', 8075)
('85*105=', 8925)
('85*115=', 9775)
('85*125=', 10625)
('85*135=', 11475)
('85*145=', 12325)
('85*155=', 13175)

('95*95=', 9025)
('95*105=', 9975)
('95*115=', 10925)
('95*125=', 11875)
('95*135=', 12825)
('95*145=', 13775)
('95*155=', 14725)
('95*165

Learn python for fun.The popular blog with questions and answers to the python.Solutions to facebookhackercup,codejam,codechef.The fun way to learn python with me.Building some cool apps.

Sunday, March 29, 2015

Finding Patterns two digit multiplication part 1


21 * 21

step 1 

20 * 20 =400

step 2

20*1
1*20
-----
40

Step 3

1*1


step 4

441

Base Method

base is 2

21 *21 = 2*(21+1)|(1*1) =44|1=441
21*22 =2*(21+2)|2=462
21*23=2*(24)6 = 486
21*24=2*(25)|4=504

visualise

21*26

considering base 20

21   1(1 away from base 20)

26   6(6 away from base 20)

----------

21+6|1*6

21+6 or 26+1 followed by 1*6

27|6

27*2|6

546


So within 20 or 30 we can do these caluclations easily

Base 30 

33*34

37*3|12

111|12

1122

or 
33*34

I know 35*35=1225

(35-2)*(35-1)

1227-105

1122


Learn python for fun.The popular blog with questions and answers to the python.Solutions to facebookhackercup,codejam,codechef.The fun way to learn python with me.Building some cool apps.

Finding Patterns Multiplication by 19 the harder way



for i in range(1,30):
 print (str(19)+"*"+str(i)+"=",19*i)
 print "difference=",((19*(i+1))/10 - (19*i)/10)
 print("=======================================")

"""
Multiplication by 19 ==> The harder way

Many would suggest ==> 1| 3|5| 7|9|11| 13| 15| 17|19  ==> odd numbers(1,3,5..)
                       9| 8|7| 6|5|4 | 3 | 2 | 1 | 0  ==> numbers from 9,8,7....
         ------------------------------
         19,38,57,76.......


 It's easy but you should write it down

This is for kids ==> Rather than by heart just know that
19*n=(2*n)-1 ==> This will be first digit 

From the observations

19*36=??
Once you know 19 table it's not a big deal but sometime for starters it's a mess to remember numbers.

I assume you know 2 table;i assume you know compliment of a number; 
for compliment pairs ==> (1,9),(2,8),(3,7),(4,6),(5,5),(6,4),(7,3),(8,2),(9,1)

Ex : 19* x = (2x-1)[compliment of x]

19*36==> (2*3 - 1)7 [compliment of 3 is 7] and (2*6 -1)4 [compliment of 6 is 4]==> 57 114 ==> 11 carry over ==> 57+11 =68==>684



"""



Learn python for fun.The popular blog with questions and answers to the python.Solutions to facebookhackercup,codejam,codechef.The fun way to learn python with me.Building some cool apps.

Wednesday, March 25, 2015

Patterns-Finding squares in the hard way


The methods 1-5 are available in most aptitude books.


Basic Assumptions:

1.You know how to caluclate squares ending with number 5

Many of us know how to caluclate square of numbers ending in 5

Ex: x5*x5=(x*x+1) 25

1. 45*45 = 4*(4+1)  25 = 2025
2. 75*75=7*8  25=5625
3. 85*85 = 8*9 25=7225


2.You know how to caluclate squares of numbers near to 100. 

Ex1:
102 * 102 = 10404

Number           By how much it is away from 100

102                          +2                            Line 1
102                          +2                            Line 2

-------                          -----
                                  04(2*2) ==>last two digits

Take 102 from first line and add 2 from 2nd line(cross)
102+2=104 ==> First first 3 digits
final answer: 10404

Ex:2

112*112

Number           By how much it is away from 100

112                          +12                            Line 1
112                          +12                            Line 2

-------                          -----
                                 144(12*12) ==>last two digits
       

Take 112 from first line and add 12 from 2nd line(cross)
112+12=124 ==> First first 3 digits
final answer:12 (4+1)44 ==> 12544



3.You know how to caluclate squares of numbers from 31-50

47*47=??

  • 47 = 50-3
  • (-3)*(-3) = 09 ==> Last two digits
  •  for first two digits  ==>[25 is used as standard]
  •  So use 25-3 = 22
  • final answer is 2209

4.You know how to caluclate squares of numbers from 51-80

64*64 =??

  • 64 = 50+14 (for 66 write as 50+16)
  • 14*14=196 take 96 for last two digits
  • First two digits ==> 25+14+1(this 1 is from 196)  = 40
    [25 is used as standard]
  • final answer 4096

5. You know how to caluclate squares of numbers from 81-100

 88*88=??

  • 88=100-12
  • Last two digits: (-12)*(-12)=144 ==>44(1 carried)
  • First two digits:88-12+1=77
  • final answer = 7744


The above methods 4 and 5 involves two steps.If you can remember some squares by heart then Instead of two steps we can acheive in one step.The above methods are easy,recommended.The methods below are for mnemonic guys.
So for academic purposes use the above methods (4,5)
 1,2 methods are common and the only easy methods.



I've seen some aptitude books,finding squares,it's fine but i want to find out a hard way.
 I was in my class way back in  2012 in mining lecture.I wanted to play with numbers .So after many caluclations i thought i found a pattern.But i didn't go beyond some huge numbers.Just confined to 3 digit caluclations.

This is a good method to find squares upto 100.You can extend upto 200 though.





 for i in range(10,127):

    print (str(i)+"*"+str(i)+"=",i*i)

    print(((i*i)/100)%10)

    print "difference=",(((i+1)*(i+1))/100 - (i*i)/100)

    print("=======================================")



This piece of got bought to me to the above conclusions


"""
Values to Memorise

base             Number             Square                 Squares you can find

4                 17                289                        [17 to 23] (base for these numbers is 4)


6                 27                 729                        [27-33] (base for these numbers is 6)

8                 37                 1369                    [37-43] (base for these numbers is 8)

10                 47                 2209                    [47-53] (base for these numbers is 10)

12                 57                 3249                    [57-63] (base for these numbers is 12)

14                 67                 4489                    [67-73] (base for these numbers is 14)

16                 77                 5929                    [77-83] (base for these numbers is 16)

18                 87                 7569                    [87-93] (base for these numbers is 18)

"""

"""
45*45 =(4*5)(5*5) = 2025 i guess everyone know for numbers ending

Type 3 Example-1




Type 2 Example-1

31*31=?

base of 31 is 6

first two digits

Now I know 30*30=900;i will take first two digits 90
31 is one number away from 30;So i need to add 6 to first two digits;
90+6=96

last digit
31*31 = 1

final answer
961





Type 1 Example-1

28*28 =

first two digits

I know 27*27 = 729,it's base is 6;Now to get the answer i will take 72 from 729 and add 6 to it
72+6=78 ==> first two digits

last digit
8*8=4(last digit)

final answer
784




PS:Post incomplete...will update in time

Learn python for fun.The popular blog with questions and answers to the python.Solutions to facebookhackercup,codejam,codechef.The fun way to learn python with me.Building some cool apps.