Chess Calculation ( Python recommend ) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Chess Calculation ( Python recommend )

This Calculation is based on the first games of Chess that was played. Write a programme to calculate it in the following way. It is said that it is imposibble to calculate it. Chess board has 64 boxes. Start from the box 1. Where initial value is 1. ( x = 1 ) In box 2 it becomes double than previous. ( x = 2 ) In box 3 it becomes bouble tha previous. ( x = 4 ) Note: It always become double than previous box value. As 1, 2, 4, 8, 16, so on... Now Write a programme that calculate value of x in box 64. ( EASY TASK.) Write another programme that calculate sum of all values of x. ( FOR EXPERTS.) share your creatipns in answers...

14th Aug 2018, 1:07 PM
C ++
C ++ - avatar
5 Answers
+ 1
Until you get to box 64, you 63-times multiply 1 by 2, therefore you get 2^63. Every value in a box is a power of two. The sum of all powers of two until 2^63 is 2^64-1 To get the numbers in python: 2**63 2**64-1
21st Aug 2018, 12:24 PM
michal
+ 1
for their sum...
21st Aug 2018, 12:32 PM
C ++
C ++ - avatar
+ 1
sum of all
21st Aug 2018, 12:32 PM
C ++
C ++ - avatar
+ 1
any app to learn logic building ..???
21st Aug 2018, 1:14 PM
C ++
C ++ - avatar
0
The sum of all is 2^64-1 It is sum of powers of 2
21st Aug 2018, 1:04 PM
michal