Wednesday, November 2, 2011

You have 500 bits

At step 0 all the bits are 0
At step 1 you toggle all the bits;
At step 2 you toggle all the even bits;
At step i you toggle all the bits in position k * i, with k an integer number

What are the bits turned on at the end?


take one bit say 26th this is toggled at steps 1, 2, 13, 26
take another one say 81 this is toggled at step 1, 9, 81

can you infer something in common?

No comments:

Post a Comment