OFFSET
1,5
COMMENTS
The light switch problem posits an infinite number of ordinally numbered lights which are initially off.
The 1st step turns all lights on.
The 2nd step turns every second one off leaving only odd lights illuminated.
The 3rd step reverses the state of every light having a number divisible by 3.
Every n-th step thereafter reverses the state of lights with numbers divisible by n.
EXAMPLE
Triangle begins:
1;
1,1;
1,3,2;
1,2,5,2,1,1;
1,2,1,1,3,1,2,1,1,1,5,3,1,4,2,1,2,4,1,3,5,1,1,1,2,1,3,1,1,2,2;
PROG
(PARI) runs(v)={my(L=List(), k=0); for(i=1, #v, if(i==#v||v[i]<>v[i+1], listput(L, i-k); k=i)); Vec(L)}
row(n)={my(m=lcm([1..n])); runs(sum(k=1, n, vector(m, i, i%k==0))%2)} \\ Andrew Howroyd, May 20 2023
CROSSREFS
KEYWORD
nonn,tabf
AUTHOR
Andrew Hardy, Feb 24 2023
EXTENSIONS
More terms from Andrew Howroyd, May 20 2023
STATUS
approved