[go: up one dir, main page]

login
A360872
Irregular triangle read by rows of the length of runs in intermediate solutions to the light switch problem.
1
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, 1, 2, 1, 2, 2, 1, 4, 1, 3, 1, 1, 3, 2, 3, 5, 3, 2, 3, 1, 1, 3, 1, 4, 1, 2, 2, 1, 2, 1, 1, 1, 2, 1, 3, 1, 1, 8, 1, 1, 1, 1, 1, 2, 4
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.
The problem asks which lights are on as n is allowed to be arbitrarily large and the solution is all n where d(n) (A000005) is odd i.e. the squares A000290. Alternatively, if 0 represents a light that is off and 1 a light that is on, the solution is represented by A010052 with offset 1.
This sequence considers intermediate solutions to arrive at A010052. After the n-th step, the lights will have a pattern which must repeat at most every LCM of {1...n} (A003418) and is given by A360845. This sequence counts the runs of 0's and 1's for each row of the irregular triangle in A360845.
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
Row n gives the run lengths in row n of A360845.
Row sums are A003418.
See A252895 for a variant of the problem.
Sequence in context: A048984 A329587 A230120 * A136531 A127318 A362689
KEYWORD
nonn,tabf
AUTHOR
Andrew Hardy, Feb 24 2023
EXTENSIONS
More terms from Andrew Howroyd, May 20 2023
STATUS
approved