Search: a060573 -id:a060573
|
|
A060572
|
|
Tower of Hanoi: the optimal way to move an even number of disks from peg 0 to peg 2 or an odd number from peg 0 to peg 1 is on move n to move disk A001511 from peg A060571 to peg A060572 (here).
|
|
+10
7
|
|
|
1, 2, 2, 1, 0, 1, 1, 2, 2, 0, 0, 2, 1, 2, 2, 1, 0, 1, 1, 0, 2, 0, 0, 1, 1, 2, 2, 1, 0, 1, 1, 2, 2, 0, 0, 2, 1, 2, 2, 0, 0, 1, 1, 0, 2, 0, 0, 2, 1, 2, 2, 1, 0, 1, 1, 2, 2, 0, 0, 2, 1, 2, 2, 1, 0, 1, 1, 0, 2, 0, 0, 1, 1, 2, 2, 1, 0, 1, 1, 0, 2, 0, 0, 2, 1, 2, 2, 0, 0, 1, 1, 0, 2, 0, 0, 1, 1, 2, 2, 1, 0, 1, 1, 2, 2
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,2
|
|
COMMENTS
|
If written in a fractal pattern of 4 X 4 squares, skipping the first square, going right then down then right then down, etc.:
X122 1011 ...
1011 0200
2200 1122
2122 1011
a number of patterns become apparent. Most notably the central diagonal going from the X down and to the right, when the 1's and 2's are reversed, gives the sequence A060571. When the same process is applied to A060571, this sequence emerges. - Donald Sampson (marsquo(AT)hotmail.com), Dec 01 2003
|
|
LINKS
|
|
|
FORMULA
|
If a(n)=0 then a(2n)=0, If a(n)=1 then a(2n)=2, If a(n)=2 then a(2n)=1, Thus a(n)=a(4n). - Donald Sampson (marsquo(AT)hotmail.com), Dec 01 2003
a(5n) = A060571(n) with the 1's and 2s reversed. - Donald Sampson (marsquo(AT)hotmail.com), Dec 08 2003
|
|
EXAMPLE
|
Start by moving first disk (from peg 0) to peg 1, second disk (from peg 0) to peg 2, first disk (from peg 1) to peg 2, etc., so sequence starts 1,2,2,...
|
|
PROG
|
(PARI) a(n) = (- (-1)^valuation(n, 2) - n)%3; \\ Kevin Ryde, Aug 07 2021
|
|
CROSSREFS
|
|
|
KEYWORD
|
easy,nonn
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|
|
A060571
|
|
Tower of Hanoi: the optimal way to move an even number of disks from peg 0 to peg 2 or an odd number from peg 0 to peg 1 is on move n to move disk A001511 from peg A060571 (here) to peg A060572.
|
|
+10
5
|
|
|
0, 0, 1, 0, 2, 2, 0, 0, 1, 1, 2, 1, 0, 0, 1, 0, 2, 2, 0, 2, 1, 1, 2, 2, 0, 0, 1, 0, 2, 2, 0, 0, 1, 1, 2, 1, 0, 0, 1, 1, 2, 2, 0, 2, 1, 1, 2, 1, 0, 0, 1, 0, 2, 2, 0, 0, 1, 1, 2, 1, 0, 0, 1, 0, 2, 2, 0, 2, 1, 1, 2, 2, 0, 0, 1, 0, 2, 2, 0, 2, 1, 1, 2, 1, 0, 0, 1, 1, 2, 2, 0, 2, 1, 1, 2, 2, 0, 0, 1, 0, 2, 2, 0, 0, 1
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,5
|
|
COMMENTS
|
a(n) is equal to a(2n) with the 1's and 2s reversed, thus a(n) = a(4n). - Donald Sampson (marsquo(AT)hotmail.com), Dec 01 2003
|
|
LINKS
|
|
|
FORMULA
|
|
|
EXAMPLE
|
Start by moving first disk from peg 0 (to peg 1), second disk from peg 0 (to peg 2), first disk form peg 1 (to peg 2), etc. so sequence starts 0,0,1,...
|
|
CROSSREFS
|
|
|
KEYWORD
|
easy,nonn
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|
|
A060574
|
|
Tower of Hanoi: using the optimal way to move an even number of disks from peg 0 to peg 2 or an odd number from peg 0 to peg 1, a(n) is the smallest disk on peg 1 after n moves (or 0 if there are no disks on peg 1).
|
|
+10
5
|
|
|
0, 1, 1, 0, 3, 3, 2, 1, 1, 2, 3, 3, 0, 1, 1, 0, 5, 5, 2, 1, 1, 2, 5, 5, 4, 1, 1, 4, 3, 3, 2, 1, 1, 2, 3, 3, 4, 1, 1, 4, 5, 5, 2, 1, 1, 2, 5, 5, 0, 1, 1, 0, 3, 3, 2, 1, 1, 2, 3, 3, 0, 1, 1, 0, 7, 7, 2, 1, 1, 2, 7, 7, 4, 1, 1, 4, 3, 3, 2, 1, 1, 2, 3, 3, 4, 1, 1, 4, 7, 7, 2, 1, 1, 2, 7, 7, 6, 1, 1, 6, 3, 3, 2, 1, 1
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,5
|
|
LINKS
|
|
|
FORMULA
|
a(3k+1) = a(3k+2) = 2*b(k) + 1, where b(k) = valuation_4((k OR 2*(4^m-1)/3)+1) is the number of times k must be divided by 4 (discarding a remainder) until the result is even, i.e., the position of the rightmost even base-4 digit of k.
(Here and below, m is any integer > log_4(k).)
a(6k) = a(6k+3) = 2*c(k), where c(k) = 1 + valuation_4(k AND (4^m-1)/3) is the number of times 2*k must be divided by 4 (discarding a remainder) until the result is odd (i.e., the position of the rightmost odd base-4 digit in 2*k), or c(k) = 0 if this never happens <=> n is in 12*A000695 + {0, 3} <=> a(n) = 0. (End)
|
|
EXAMPLE
|
Start by moving first disk from peg 0 to peg 1, second disk from peg 0 to peg 2, first disk from peg 1 to peg 2, etc. so sequence starts 0, 1, 1, 0, ...
|
|
PROG
|
(PARI) A060574_upto(n, p=[[]|n<-[1..3]])={p[1]=[1..n]; vector(2^n-1, n, my(a = n\2%3+1, b = a%3+1); bittest(n, 0) || if( !p[a = b%3+1] || (#p[b] && p[b][1] < p[a][1]), [a, b] = [b, a]); p[b] = concat(p[a][1], p[b]); p[a] = p[a][^1]; if(p[2], p[2][1]))} \\ This produces the sequence for n pegs, i.e., of length 2^n-1 ! - M. F. Hasler, Mar 28 2022
apply( {A060574(n, t=n%3>0)=n\=3<<!t; for(k=1, oo, n%2==t||return(k*2-t); (n\=4) || t || break)}, [0..99]) /* or alternate code, illustrating the formula: */
apply( {A060574(n)= if ( n%3, 1+2*valuation(1+bitor(n\3, 4^exponent(n)\6), 4), n && n = bitand(n\6, 4^exponent(n)\3), 2*valuation(n, 4)+2, 0)}, [0..99])
|
|
CROSSREFS
|
|
|
KEYWORD
|
easy,nonn
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|
|
A060575
|
|
Tower of Hanoi: using the optimal way to move an even number of disks from peg 0 to peg 2 or an odd number from peg 0 to peg 1, a(n) is the smallest disk on peg 2 after n moves (or 0 if there are no disks on peg 2).
|
|
+10
4
|
|
|
0, 0, 2, 1, 1, 2, 0, 0, 4, 1, 1, 4, 3, 3, 2, 1, 1, 2, 3, 3, 4, 1, 1, 4, 0, 0, 2, 1, 1, 2, 0, 0, 6, 1, 1, 6, 3, 3, 2, 1, 1, 2, 3, 3, 6, 1, 1, 6, 5, 5, 2, 1, 1, 2, 5, 5, 4, 1, 1, 4, 3, 3, 2, 1, 1, 2, 3, 3, 4, 1, 1, 4, 5, 5, 2, 1, 1, 2, 5, 5, 6, 1, 1, 6, 3, 3, 2, 1, 1, 2, 3, 3, 6, 1, 1, 6, 0, 0, 2, 1, 1, 2, 0, 0, 4
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,3
|
|
LINKS
|
|
|
EXAMPLE
|
Start by moving first disk from peg 0 to peg 1, second disk from peg 0 to peg 2, first disk from peg 1 to peg 2, etc. so sequence starts 0,0,2,1,...
|
|
CROSSREFS
|
|
|
KEYWORD
|
easy,nonn
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
Search completed in 0.006 seconds
|