|
| |
|
|
A077403
|
|
In base 3: smallest number which requires n Reverse and Add! steps to reach a palindrome.
|
|
0
| |
|
|
0, 3, 5, 15, 17, 263, 170, 509, 491, 322, 266, 222, 161, 494, 260, 106, 95, 78, 53, 2425, 1466, 9717, 59583, 38878, 38798, 33515, 39440, 32857, 37340, 238849, 177470, 60019, 59655, 178540, 124895, 59753, 179751, 1595576, 715615, 354605, 179575
(list; graph; refs; listen; history; internal format)
|
|
|
|
OFFSET
| 0,2
|
|
|
COMMENTS
| Base 3 analogue of A066058 (base 2), A077441 (base 4) and A023109 (base 10).
|
|
|
LINKS
| Index entries for sequences related to Reverse and Add!
|
|
|
EXAMPLE
| 5 is the smallest number which requires two steps to reach a base 3 palindrome (cf. A066057), so a(2) = 5; 5 (decimal) = 12 -> 12 + 21 = 110 -> 110 + 011 = 121 (palindrome) = 16 (decimal).
|
|
|
PROG
| (ARIBAS) var ar: array; end; m := 45; ar := alloc(array, m+1, -1); mc := m+1; n := 0; while mc > 0 do v := -1; c := 0; k := n; while c < m+1 do d := k; rev := 0; while d > 0 do rev := 3*rev+(d mod 3); d := d div 3; end; if k = rev then v := c; c := m+1; else inc(c); k := k+rev; end; end; if 0 <= v and v <= m then if ar[v] < 0 then ar[v] := n; dec(mc); write((v, n)); end; end; inc(n); end; writeln(); for j := 0 to m do write(ar[j], ", "); end;
|
|
|
CROSSREFS
| Cf. A066057, A066058, A077441, A023109.
Sequence in context: A077406 A054432 A016043 * A002962 A018374 A063185
Adjacent sequences: A077400 A077401 A077402 * A077404 A077405 A077406
|
|
|
KEYWORD
| base,nonn
|
|
|
AUTHOR
| Klaus Brockhaus (klaus-brockhaus(AT)t-online.de), Nov 05 2002
|
| |
|
|