Zero the byte (eventually) Given an infinite arithmetically-progressive¹ sequence, compute the minimum length of a prefix with a product divisible by 2^8.

Sample cases &amp; reference implementation

Here is a reference implementation that I wrote in Io.

  1, 1 -&gt; 10
  2, 4 -&gt; 8
  3, 5 -&gt; 10
  2, 6 -&gt; 5
  7, 5 -&gt; 6
  4, 1 -&gt; 9
 10, 9 -&gt; 7
256, 9 -&gt; 1


Spec


The input will always be provided in a way such that it won't take forever to zero the accumulator.
¹ An arithmetically progressive infinite list can be generated by a constant step each time starting from an initial number.


For the infinite list input, you're are allowed to simply take the initial number and the step of the infinite list.

There are only going to be integers in this sequence.

Examples
1*2*3*4*5*6*7*8*9*10 = 3,628,800
= 14,175*256
2*6*10*14*18*22*26*30 = 518,918,400 = 2,027,025 * 256
Python 2, 39 bytes



f=lambda a,d,p=1:p%256and-~f(a+d,d,p*a)


Try it online!

Tracks the product p of the arithmetic progression until it's divisible by 256.