[Question]
  [
Given an infinite arithmetically-progressive¹ sequence, compute the minimum length of a prefix with a product divisible by 2^8.
## Sample cases & reference implementation
[Here](https://tio.run/##fU/LDsIgELzzFZsmTQA5CD7SNOEbvOgH1NpGYoWm4vcjj0jaGDsXdnZ2ZhdlnOuhlvDs7N3csNLKMnjZbmQIPFrz1jbo20ibUIaZxNo2cB7JYMwIOJZfTQIOD4WGQAlYAKVQkcXIOCltB517qo@WEgSlFUi/l2UtoDhdznWRbAsBp0s3wMlPaMB16ppH7syO8Fc23ha@nJspS0LORMlEEOoxZ5ygQs5Q5I09Fmy/ou7YYdV7XFE5E/9U5z4) is a reference implementation that I wrote in Io.
```
  1, 1 -> 10
  2, 4 -> 8
  3, 5 -> 10
  2, 6 -> 5
  7, 5 -> 6
  4, 1 -> 9
 10, 9 -> 7
256, 9 -> 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
  
[Answer]
# [Python 2](https://docs.python.org/2/), 39 bytes
```
f=lambda a,d,p=1:p%256and-~f(a+d,d,p*a)
```
[Try it online!](https://tio.run/##JYrBCsMgEETv/Yq9FNZ0C9FGSwr5mA1GIqRWgqX0kl83iqeZN2/iP62foHJ208bv2TIwWYqTfMWr0oaDvR8O@Wbr2rHIv9VvCxS9@5DAYedD/CYUIqMkkOKCimAo8SDQjUyJZ6OhXWRPMFapTS0n "Python 2 – Try It Online")
Tracks the product `p` of the arithmetic progression until it's divisible by 256.
[Answer]
# [APL (Dyalog)](https://www.dyalog.com/), 24 bytes
```
{0=256|×/⍵:≢⍵⋄⍺∇⍵,⍨⊃⍺+⍵}
```
[Try it online!](https://tio.run/##SyzI0U2pTMzJT///P@1R24RqA1sjU7Oaw9P1H/VutXrUuQhIPepuedS761FHO5Ct86h3BZCj/airGcir/f/fUCFNwZDLBEgaKXCZAiljBS4zBM@cC6TARIHLEqTOAEIDbVAAAA "APL (Dyalog Unicode) – Try It Online")
`⍵` is the the sequence (starting with the first item), `⍺` the step.
---
`0=256|×/⍵` - if the product is divisible by 256, `≢⍵` return the length.
`⍺∇⍵` - else, recurse, `,⍨⊃⍺+⍵` - and append a new term to the sequence.
[Answer]
## INTERCAL, 471 445 443 bytes
I could have done anything else but I've always wanted to try this language out...
```
DOWRITEIN:5DOWRITEIN:6DO:8<-:5DO:7<-#1PLEASECOMEFROM(9)DO:1<-:6DO:2<-:7DO(1549)NEXTDO:1<-:3DO:2<-:5DO(1509)NEXTDO:1<-:3DO:2<-:8PLEASEDO(1549)NEXTDO:8<-:3DO:1<-:8DO:2<-#256PLEASEDO(1550)NEXTDO:4<-:1DO:1<-:3PLEASEDO(1540)NEXTDO:1<-:4DO:2<-:3PLEASEDO(1510)NEXTDO:1<-:3DO:2<-:3PLEASEDO(1550)NEXTDO:1<-#1DO:2<-:3DO(1509)NEXTDO(1)NEXTDO:1<-:7DO:2<-#1DO(1509)NEXT(9)DO:7<-:3(1)DO(2)NEXTPLEASEFORGET#1DO:1<-:7DO:2<-#1DO(1509)NEXTDO:7<-:3PLEASEREADOUT:7PLEASEGIVEUP(2)DORESUME:3
```
Inspired by Noodle9's C answer.
Formatted version:
[Try it online!](https://tio.run/##fZJNC8IwDIbv/RUBL/MgrNvq5vAiLpOBWqmdehXxIIgH8f/PtXaa@nVL6PMmb5KeLrfj9bA/N00hYasqjVAtIRfMS4cmzTMYD9xTnpq4xxlbzXGyRpjKBUKp5AKCUZ9ZhFv8IY1snJo44CIZ9WGJO02wmGDCYeF/LOt6fymaOZpIs5e0F4mhLxYhESeW515bv1X4YSwhxt5o3tE/5oj/WOFuzZR@Ww6x7M2bknn5N1HAu6Q9GTyPaqqYJ0NEjnAGS6lmqOnZFU4KkLUmU8yqDUK9aotEtojCdd3@jXZDTaO3kpWyVnAH "INTERCAL – Try It Online")
Explaination based on blocks, blocks seperated by double line breaks.  
(if magic) marks code for an If-structure I've found in the manual.
```
Setup vars and input
 - :5 = start value
 - :6 = step size
 - :7 = step count
 - :8 = current cumultative product 
Label (99)
:8 *= (:7 * :6) + :5
Calculate :8 % 256 
Divide result by itself and add one.
If the result is 0, the division subroutine returns 0, else it returns 1.
We need to add one becase label (0) is invalid.
Store result in :10
Increment :7, store result in :3
(if magic)
If :10 is 2, put :3 in :7 and jump to (99)
(if magic)
If :10 is 1, print :3 and terminate
(if magic)
```
If someone can get rid of that double addition, I'd be *very* grateful.
### EDIT
Found out a way to get rid of it. Also updated the explaination and fixed some formatting.
-2 by using a shorter label
[Answer]
# [Husk](https://github.com/barbuz/Husk), 9 bytes
```
V¦256G*¡+
```
[Try it online!](https://tio.run/##yygtzv6f6/aoqfF/2KFlRqZm7lqHFmr///8/WsNQx1BTR8NExwhImuoYA0kzKNscSBrqmABJSx1DAzAF1KkZCwA "Husk – Try It Online")
Takes first the step, then the initial value.
# Explanation
```
V¦256G*¡+  Implicit arguments: step and start
        +  Function that adds step.
       ¡   Iterate on start to form infinite list [start, start+step, start+2*step..]
     G     Cumulative reduce by
      *    multiplication.
V          1-based index of first value that
 ¦256      is divisible by 256.
```
[Answer]
# [Raku](https://github.com/nxadm/rakudo-pkg), ~~38~~ 31 bytes
```
{+($^a,*+$^b...{[*](@_)%%256})}
```
[Try it online!](https://tio.run/##Tc1BDoIwFATQPaeYBRigX6AIRQwa74FgMFJjAmpgRZCz1zZh4e5NZn7@px06ofoJG4mjmplr1w35zK5vQRDMpV@556vnOHEqFm9RYzNB4suKoj88wsudhWVEvIJ8D@ier3ZUACdwbE/gkQXEhMSEvfaOkP4XwoRUO1sLoZ2s17mld4TcOLP0@9X8Bw "Raku – Try It Online")
Does pretty much exactly what the description asks for. Generates the arithmetic sequence until the product of elements is divisible by 256 and returns the length of the list. 
[Answer]
# JavaScript (ES6), 33 bytes
Takes input as `(step)(init)`.
```
s=>g=(i,p=1)=>p&&g(i+s,p*i%256)+1
```
[Try it online!](https://tio.run/##dc47CoAwEATQ3nsou/4wahSL9S7iJ0TEBCNeP8ZSojDVY2BmHa7BjIfUZ7arabYLWUO9IJCpJobU6ygSIBOT6liGJW8wYXZUu1HbnG9KwAIMXTB4Y41QesgRKg@bn2broRuqPezcevGlz1e0Nw "JavaScript (Node.js) – Try It Online")
[Answer]
# [MATL](https://github.com/lmendo/MATL), 17 bytes
```
ha`&G@q*+*8W\t}x@
```
[Try it online!](https://tio.run/##y00syfn/PyMxQc3doVBLW8siPKaktsLh/39jLlMA) Or [verify all test cases](https://tio.run/##y00syfmf8D8jMUHN3aFQS1vLIjympLbC4X@sS1RFyH9DLkMuIy4TLmMuUyBtxmUOpE2AYoYGXJZcRqZmXJYA).
### Explanation
This uses the fact that `mod(a*b, N)` equals `mod(mod(a, N)*b, N)`.
```
h       % Take the two inputs (implicitly): a (initial term), s (step).
        % Concatenate them into a row vector
a       % Any: true (or 1) if there is any nonzero entry. Gives true
`       % Do...while
  &G    %   Push the two inputs again: a, s
  @q    %   Push n-1, where n is the 1-based iteration index
  *     %   Multiply: gives s*(n-1)
  +     %   Add: gives a+s(n-1), which is the n-th term of the sequence
  *     %   Multiply this by the previous result (which was initialized to 1)
  8W    %   Push 8, exponential with base 2: gives 256
  \     %   Modulus
  t     %   Duplicate. This will be used as loop exit condition
}       % Finally (execute this on loop exit)
  x     %   Delete latest result (which is necessarily 0)
  @     %   Push current n. This is the solution
        % End (implicitly). A new iteration is executed if the top of the
        % stack is nonzero
        % Display (implicitly)
```
[Answer]
# [J](http://jsoftware.com/), 30 29 bytes
```
[:#(],(+{:))^:(0<256|*/@])^:_
```
[Try it online!](https://tio.run/##y/qvpKeepmBrpaCuoKNgoGAFxLp6Cs5BPm7/o62UNWJ1NLSrrTQ146w0DGyMTM1qtPQdYoG8@P@aXKnJGfkKhgYKtgqGCmkKhhC@BZBrAuQaIUmbAvnGEL4pkGuGkDaDyppDuJZQs0wgXHMg1xJktAHUMCgf6A6u/wA "J – Try It Online")
*-1 byte thanks to Traws*
Straightforward conversion of the algorithm into J.
[Answer]
# [brainfuck](https://github.com/TryItOnline/brainfuck), ~~80~~ 71 bytes
```
,>>,->+[<[-<+>>[->+>+<<]>[-<+>]<<]<[->+<]<[->+>+<<]>[-<+>]>>>>[-<<+>>]>+<<<]>>>.
```
[Try it online!](https://tio.run/##SypKzMxLK03O/v9fx07Hzk472sYmWtdO2w5MaNvYxNoBmTY22nZ2sTZAEGsDl9ABM4EKgHJANbEQBXr//xsaAgA "brainfuck – Try It Online")
Takes two byte values as input (step, initial), output a byte value.
[Commented code](https://tio.run/##lVLLbtswEDyHXzFQDkwgy6mLnmxWh35B744OFEVHQiRRoKjYAYL@urukHlaKXCqAELmcmd2dZS778vpidYfEgB@zo0g32zjJOIQA1@bE8eEskgL8ueVIIbf56boBcA@rZYHe6Y6lm@VctZVjaRrTubOmGJT7uWPHgD@XVa3n6J4xIca4K6setTEdmqF2VVdXup9hyN@D5AGtOaMzVeu0BeGlG1MllMqL9EPurFRj1LN2BzTmTYNOzoQoZ3fpkfBpLESGwJJFsWQi1LTlE/WLG69BIkLEaZqRRaSxhnKOXKrXFYPdedTt8za5wbb90sxUHcsYu/dd7r9o87DUQjFXapj6VvibrAeNh2boqXENVWtpdYFaksYjW@bAPbfV5888GsPKk6kbP1Rfl/9zPPhkvorHTTBsvh09DXSRpWNzga7M0AbXwoazeN1/1SqrG02AcEtvhfwc6TPfNzh78I@dHLItxhYXh2kOQmyv9FhZZ4l1QvTr3U1l7BEdcFZIFER4vEyr0iD6bc2LlQ2cvrh9NAX/@C9iilxfoJ@v5gTPl287vyJ8wFWNNoPDrseT6dxTbmXVngb1etsFOYJeLsVa4get7/8vcf0L) (Memory layout: `count step init init' prod prod' prod''`)
This language has a slight advantage for this challenge because its cell size value (in the TIO implementation) is 8-bit.
This program has to use ~5 variables, so some other rearrangement might produce a shorter program.
Use a scrolling tape to reduce back-and-forth copying. (after each iteration of the outermost loop the pointer is moved 1 unit to the right)
[Answer]
# [K (ngn/k)](https://bitbucket.org/ngn/k), ~~27~~ ~~25~~  ~~19~~ 18 bytes
-2 bytes thanks to Traws!
-6 bytes thanks to ngn and Traws!
-1 more byte thanks to ngn!
```
{#(`c$*/)(x,y+)/x}
```
[Try it online!](https://tio.run/##y9bNS8/7/z/NqlpZIyFZRUtfU6NCp1JbU7@i9n9atKG1gmEsV1q0kbWCCYg2tlYwhfLNQLQ5lG8CVWdoYK1gCVZgagZi/QcA "K (ngn/k) – Try It Online")
[Answer]
# [Factor](https://factorcode.org/), 105 bytes
```
: f ( n n -- n ) swap 1array
[ dup product 256 mod 0 = ]
[ 2dup last + 1array append ] until
length nip ;
```
[Try it online!](https://tio.run/##LU5BCsIwELznFXNUpGJrVax4Fi@9iBfFQ2xXLcY0Jlukr49pKAs7s8zuzD5kxa3159OxPBSQ1sre4U1Wk8JH8guOvh3pihyMJebe2EYzduJYFriQbRN@UXLvmXyBBybQoZIktCncTxqk0VNcUXcmWLR1VzGy1RqftsYCe9yClg2iko4xGw8gjSFd44ZOc6OEIv0M3@jGYOdTpCFrLjLkEZdYjfM64mac83EvXWA7EIghOFL/Bw "Factor – Try It Online")
[Answer]
# [APL (Dyalog)](https://www.dyalog.com/), 19 bytes
```
{0⍳⍨256|×\⍵+⍺×0,⍳9}
```
[Try it online!](https://tio.run/##SyzI0U2pTMzJT9dNzkksLs5M/v8/7VHbhGqDR72bH/WuMDI1qzk8PeZR71btR727Dk830AGKW9b@/2@okKZgyGUCJI0UuEyBlLEClxmCZ84FUmCiwGUJUmcAoYGGKQAA "APL (Dyalog Classic) – Try It Online")
Uses `⎕IO←1` and the fact that the highest possible output is `10`.
[Answer]
# [Retina 0.8.2](https://github.com/m-ender/retina/wiki/The-Language/a950ad7d925ec9316e3e2fb2cf5d49fd15d23e3d), 70 bytes
```
\d+
$*
^
1,
{`^1.*
$&#
\G1(?=1*,(1+))
$1
1{256}
}`1,(1+(,1+))
1$2$1
#
```
[Try it online!](https://tio.run/##HYu9CoMwFEb37zUSJcaL@KX@4FAc8xIiEezQpYO4ic@e3nY6cA7neJ3vz5YLF1Ne9hrWYwUFV1rZeNjSYIl085NeHOuqgiV4hX64gTvxJ538A23QZnKmEEE6PKRXDhiVnTq2MkFPmb4 "Retina 0.8.2 – Try It Online") Link includes test cases. Explanation:
```
\d+
$*
```
Convert to unary.
```
^
1,
```
Insert an accumulator.
```
^1.*
$&#
```
Increment the result if the accumulator is not zero.
```
\G1(?=1*,(1+))
$1
```
Multiply the accumulator by the current term.
```
1{256}
```
Reduce modulo 256.
```
1,(1+(,1+))
1$2$1
```
If the accumulator is not zero then calculate the next term. (The conditional is necessary in order for the loop to terminate once the accumulator reaches zero.)
```
{`
}`
```
Repeat the loop until the buffer stops changing. This will happen when the accumulator becomes zero, i.e. the product is a multiple of 256.
```
#
```
Convert the result to decimal.
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), 24 bytes
```
⊞υＮＮηＷ﹪ΠＥυΣ…υ⊕λ²⁵⁶⊞υηＩＬυ
```
[Try it online!](https://tio.run/##TU27CgIxEOz9ipQbOBvlbK5MJXgS8AtibjEHeZHbVfz6mCCC0wzDvKwzxSbja9W8OeBBnGNmunK4YwEpp92/dk2/3OpRwJwW9gl0aWwJZpN7@cYB1Nt6VC7l75otGDASLuBlxyAO40lK8fvrm7qskUCZjeCC8UHNaMmp1qMY6/7pPw "Charcoal – Try It Online") Link is to verbose version of code. Explanation:
```
⊞υＮ
```
Input the initial number and push it to the predefined empty list.
```
Ｎη
```
Input the step.
```
Ｗ﹪ΠＥυΣ…υ⊕λ²⁵⁶
```
Repeat while the product of the sums of all the nontrivial prefixes of the list is not a multiple of 256...
```
⊞υη
```
... push the step to the list.
```
ＩＬυ
```
Output the length of the list.
[Answer]
# [Brachylog](https://github.com/JCumin/Brachylog), 23 bytes
```
≜;.{|⟨+≡t⟩ⁱ}ᶠ⁽hᵐ×%₂₅₆0∧
```
[Try it online!](https://tio.run/##SypKTM6ozMlPN/pfXa6koGunoFRuX/eobcOjpqaHuzprH26d8P9R5xxrveqaR/NXaD/qXFjyaP7KR40bax9uW/CocW8GUMHh6apA1Y@aWh81tRk86lj@/3@0QrShjmGsTrSRjgmQNNYxBbPNgKQ5mG0CljU00LEESZiaAWmFWAA "Brachylog – Try It Online")
This took embarrassingly long to write, but at least I was able to shave two bytes off `∧.≜&{|⟨+≡t⟩ⁱ}ᶠ↖.hᵐ×%₂₅₆0∧` once I got that far. Takes `[first term, step]` through the output variable and outputs the prefix length through the input variable.
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 16 [bytes](https://github.com/DennisMitchell/jelly/wiki/Code-page)
```
1µ⁴ẋ³1¦ÄP256ḍµ1#
```
A full program accepting the initial value and the delta which prints the result.
**[Try it online!](https://tio.run/##ASgA1/9qZWxsef//McK14oG04bqLwrMxwqbDhFAyNTbhuI3CtTEj////M/81 "Jelly – Try It Online")**
### How?
```
1µ⁴ẋ³1¦ÄP256ḍµ1# - Main Link: initial, delta
1                - set the left value (say n) to 1
              1# - increment n finding the first 1 such n which is truthy under:
 µ           µ   -   the monadic chain - i.e. f(n):
  ⁴              -     program argument 4 (delta)
   ẋ             -     repeated (n) times
      ¦          -     sparse application...
     1           -     ...to indices: 1
    ³            -     ...what: program argument 3 (initial)
       Ä         -     cumulative sums
        P        -     product
         256     -     literal 256
            ḍ    -     divides (the product)?
                 - implicit print (a list with a single element prints that element)
```
[Answer]
# [C (gcc)](https://gcc.gnu.org/), ~~46~~ 44 bytes
Saved 2 bytes thanks to [Arnauld](https://codegolf.stackexchange.com/users/58563/arnauld)!!! 
```
c;f(a,d){c=0;for(char p=1;p*=a+d*c++;);d=c;}
```
[Try it online!](https://tio.run/##fZDbaoQwEIbv9ykGQYgaqYdqK2l6U/oU61JColuhdcUIlYqvXjvGQ5e9aCCZTPi/f2Yi/bOU0yRZSQRVziB5wMpLS@S7aKHhIWtcLjzlSs9jDlNcsnH6FFVNHBgOgKuqO@gK3ek3cTwBhyGkABGFeAkPFO4phAGFKElHdoOoPwRVCYbUBHzIMMmugKJvCtmh3gDo97jYojo1aqwE4QrM3bvQLu5W3r9GeZ@94E4sCtd5bCFhEBwayFyoqlXRIxew9foEuvouLiVZx3Tu1hzVDgPPM7LtP7Z@NVrsyNFITnQfe8kdtiNNi1BJLDtWFGwF/vN82jqvLfq/CQVNcdT1f5Y34Bz0Zj8eDuP0I8sPcdaT//UL "C (gcc) – Try It Online")
**Commented code**
```
c;f(a,d){
 c=0;           /* initialise counter */
 for(char p=1   /* initialise 8-bit product */
   p            /* loop until last 8-bits of product are 0 */
    *=a+d*      /* and multiply product by next element in series */
       c++;);   /* and bump counter */
 d=c;           /* return counter */
}
```
[Answer]
# [Wolfram Language (Mathematica)](https://www.wolfram.com/wolframscript/), 59 bytes
```
(t=0;s=#;k=#2;While[Mod[s##&@@Array[s+k#&,t++],256]!=0];t)&
```
[Try it online!](https://tio.run/##HYlBC8IgGEB/SwhS@EFqcyNEsB8QdOsgHqTGJmsF6iVkv93My3sP3urSPK4u@Ycrkyr7pKiMCslFIS7vs3@N5vp5mogQ1voSgvuaSBaEIRFigYve7hS1Mh1wuQX/Tkc9aa1zZsA2yBy6yhOI1n3l0Lprl1E4/4foq7dSfg "Wolfram Language (Mathematica) – Try It Online")
[Answer]
# [R](https://www.r-project.org/), 43 bytes
```
function(i,s)match(0,cumprod(i+0:9*s)%%256)
```
[Try it online!](https://tio.run/##XYzNCoQgFEb3PUUwBDrdhbfSMuhhwhpGSI1@nt8Qs0XLc/i@s3mj7TLbwf9Oqw7tLNGwUzMe6k8YqNOsm5uILlkvvzstiooLen8IAtL8kyPLblFBE0SXuAb@HoggeOI2DkTiJhZlYmQgg2ifABfRYOYv "R – Try It Online")
Outputs 'NA' if sequence goes to infinity without ever being a multiple of 256. 
Calculates products of sequences up to length 10. Why is this enough? 
If step is an odd number, then the successive factors that make up each element of the sequence will alternate between odd and even, so 10 would be enough to ensure that there are 5 even numbers multiplied together (so the product is a multiple of 2^5). But, the first 5 even numbers are also certain to include at least one multiple-of-4 (every second even number) and one multiple-of-8 (every fourth even number), so in fact their product is certain to be a multiple of 2^8 = 256. 
If the step is even and the initial number is even, then (for similar reasons) only a maximum of 4 steps are needed.
If the step is even and the initial number is odd, then all the factors will be odd, so the product will always be odd and the sequence will go to infinity without ever being a multiple of 256. 
So, if we didn't find a multiple-of-256 by the 10th element of the sequence, there won't be one, and we can just output the 'infinity' response. 
I think. 
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E/wiki/Commands), 12 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage)
```
∞<*+ηPÅΔ₁Ö}>
```
Takes the inputs in reversed order, so `step` before `start`.
[Try it online](https://tio.run/##yy9OTMpM/f//Ucc8Gy3tc9sDDreem/KoqfHwtFq7//9NuIwA) or [verify all test cases](https://tio.run/##yy9OTMpM/V9Waa@k8KhtkoKSfWXC/0cd82y0tM9tDzjcem7Ko6bGw9Nq7f7r/I@ONtQxjNWJNtIxAZLGOqZgthmQNAezTcCyhgY6liAJUzMgHQsA).
**Explanation:**
```
∞             # Push an infinite positive list: [1,2,3,...]
 <            # Decrease each by 1 to let it start at 0: [0,1,2,...]
  *           # Multiply each by the first (implicit) input (step)
   +          # Add the second (implicit) input (start)
    η         # Get all prefixes of this infinite list
     P        # Take the product of each inner prefix-list
      ÅΔ      # Find the first (0-based) index which is truthy for:
        ₁Ö    #  Where the value is divisible by 256
          }>  # After we've found this index: increase it by 1 to make it 1-based
              # (after which the result is output implicitly)
```
[Answer]
# [Rust](https://www.rust-lang.org/), 58 bytes
```
|s,m|(|mut i,mut a|{while 0<a%256{a*=i;i+=m}(i-s)/m})(s,1)
```
[Try it online!](https://tio.run/##hc5NCoMwEAXgfU/xKhSSdkRjNWqtvYsLpQETij90ET27VQRXgW5mFt@8menGflgaA10pwzjsCWjrAc0DjWGjjAlr4fBfW0e5TD3piU16HKBoq9Vkv2/V1gif1SVKpK2upSrUrdQzU37PAz1z1pPgS7Hu/nTKDK05M8/OHqFhgiA4LxAEInR5RMh2z1x8JyR/4nL3xMXpEZcujo/ncufvISHfPXUeT@QxIE7z8gM "Rust – Try It Online")
A closure whose first argument is the first element of the sequence and whose second argument is the step.
Ungolfed with comments
```
//Initial element, step
|s,m|
  //i is initial value of s, a is accumulator
  (|mut i,mut a| {
    while 0 < a % 256 {   //while a is not divisible by 2^8
      a *= s;             //Multiply a by the current element of the sequence
      s += m              //Get the next element of the sequence by adding the step
    }
    //Subtract the initial value s to only keep increases of m, divide by m to get how many times it was increased
    (i - s) / m
  )
   (s, 1) //Call with i as s and initial value of accumulator as 1
```
[Answer]
# Scala, 54 bytes
```
LazyList.from(_,_).scanLeft(1)(_*_)indexWhere(_%256<1)
```
[Try it in Scastie!](https://scastie.scala-lang.org/JvvccbCcSsyfoX5prS7ZNQ)
Explanation:
```
LazyList.from(_,_) //Creates a LazyList starting at the first parameter with a step given by the second parameter.
  .scanLeft(1)(_*_) //scanLeft is like foldLeft, but keeps each result in a list
  indexWhere(_%256<1) //Find the index where it's divisible by 256
```
[Answer]
# [Haskell](https://www.haskell.org/), ~~51~~ 49 bytes
```
b#s=findIndex((<1).(`mod`256))$scanl(*)1[b,b+s..]
```
[Try it online!](https://tio.run/##LYpBC4IwGED/ygd6@FZrNEsjyE5dAm8dTXA2xZGb4r6of28Znt578Frln3XXTcYO/UhwUaREZjxNVeDTxjh9dbr@IJ4kE1jaXpdRnDAW@odyHa6YzCterb0QxWSVcenwohuNmQt9279DqwbAO8HmDNh4AmIQAHqnf8YgR8lBMg4YcdjP3HGIl05mHpbeL5/ccjj@hziZrZi@ "Haskell – Try It Online")
Port of my [Scala answer](https://codegolf.stackexchange.com/a/210146/95792)
]