PUZZLE IBM-226
How many Boolean sequences
IBM Research · Ponder This · 2017-02
IBM Ponder This #226 · February 2017
When you run the following pseudo code on a sequence of six bits, in exactly 14 cases you get a non-zero value. How many such cases would you get for all sequences of 42 bits?
s=2
r=0
for b in v:
if (s modulo 7) = b:
r = r+2*b-1
s = 6+s*(5+s*s*s*(2+s*(3+s))) + b*(5+s*(5+s*(6+s*s*(3+s*6))))
return r
Bonus question: If we would have asked a similar question for sequences of 14 bits, what would be the connection of the result to IBM?
Hint: We asked a similar bonus question in the past, and the number of solvers was then a multiplication of two prime numbers.
Solution
Best opened after a real attemptTo be added.