TORONTO KIDS COMPUTER CLUB | Blog
1815
paged,page-template,page-template-blog-large-image,page-template-blog-large-image-php,page,page-id-1815,paged-68,page-paged-68,ajax_fade,page_not_loaded,,no_animation_on_touch,qode-theme-ver-7.6.2,wpb-js-composer js-comp-ver-6.10.0,vc_responsive

Blog

03 Jul Aurora Saturday 14:30 Python Practice 22.06.25.

Question:  Starting with x and repeatedly multiplying by x, we can compute x31 with thirty multiplications: x2 = x × x, x3 = x2 × x, x4 = x3 × x, …, x31 = x30 × x. The operation of squaring can be appreciably shorten the sequence of multiplications. The following is a way to compute x31 with eight multiplications: x2 = x × x, x3 = x2 × x, x6 = x3 × x3, x7 = x6 × x, x14 = x7 × x7, x15 = x14 × x, x30 = x15 × x15, x31 = x30 × x. This is not the shortest sequence of multiplications to compute x31. There are many ways with...

Read More