Sunday, March 29, 2015

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.

No comments:

Post a Comment