[go: up one dir, main page]

login
Search: a065206 -id:a065206
     Sort: relevance | references | number | modified | created      Format: long | short | data
In base 2, one 'Reverse and Add' step is needed to reach a palindrome.
+10
12
2, 4, 6, 8, 10, 12, 14, 16, 18, 24, 30, 32, 34, 36, 38, 40, 42, 48, 52, 56, 62, 64, 66, 68, 70, 80, 82, 96, 100, 102, 112, 114, 126, 128, 130, 132, 134, 136, 138, 140, 142, 144, 146, 148, 150, 160, 162, 168, 170, 176, 178, 192, 196, 198, 200, 204, 208, 212, 224
OFFSET
1,1
COMMENTS
The analog of A065206 in base 2. The number of steps starts at 0, so palindromes (cf. A006995) are excluded.
PROG
(ARIBAS): function b2revadd_steps(k, stop: integer); var c, n, m, steps, rev: integer; begin n := 0; c := 0; while c < stop do m := n; rev := b2reverse(m); steps := 0; while steps < k and m <> rev do m := m + rev; rev := b2reverse(m); inc(steps); end; if steps = k and m = rev then write(n, " "); inc(c); end; inc(n); end; end; b2revadd_steps(1, 66).
(PARI) Rev(x)= { local(d, r=0); while (x>0, d=x%10; x\=10; r=r*10 + d); return(r) } digitsIn(x)= { local(d); if (x==0, return(1)); d=1 + log(x)\log(10); if (10^d == x, d++, if (10^(d-1) > x, d--)); return(d) } Palin(x)= { local(d, e, f, i, t, y); if (x==0, return(1)); y=x; d=digitsIn(x); t=10^(d - 1); for (i=1, d\2, f=y-10*(y\10); y\=10; e=x\t; x-=t*e; t/=10; if (e!=f, return(0)) ); return(1) } baseE(x, b)= { local(d, e=0, f=1); while (x>0, d=x-b*(x\b); x\=b; e+=d*f; f*=10); return(e) } baseI(x, b)= { local(d, e=0, f=1); while (x>0, d=x-10*(x\10); x\=10; e+=d*f; f*=b); return(e) } { n=0; for (m=1, 10^9, b=baseE(m, 2); r=Rev(b); d=baseI(r, 2) + m; b=baseE(d, 2); if (Palin(b), write("b066122.txt", n++, " ", m); if (n==1000, return)) ) } \\ Harry J. Smith, Feb 01 2010
CROSSREFS
KEYWORD
base,nonn
AUTHOR
Klaus Brockhaus, Dec 08 2001
EXTENSIONS
OFFSET changed from 0,1 to 1,1 by Harry J. Smith, Feb 01 2010
STATUS
approved
One iteration of Reverse and Add is needed to reach a palindrome.
+10
6
1, 2, 3, 4, 10, 11, 12, 13, 14, 15, 16, 17, 18, 20, 21, 22, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 35, 36, 38, 40, 41, 42, 43, 44, 45, 47, 50, 51, 52, 53, 54, 56, 60, 61, 62, 63, 65, 70, 71, 72, 74, 80, 81, 83, 90, 92, 100, 101, 102, 103, 104, 105, 106
OFFSET
1,2
COMMENTS
The number of iterations starts at 1, so palindromes (cf. A002113) are not excluded. The corresponding sequence excluding palindromes is A065206.
MATHEMATICA
rev[n_] := FromDigits[Reverse[IntegerDigits[n]]]; Select[Range[106], rev[x = # + rev[#]] == x &] (* Jayanta Basu, Jul 24 2013 *)
Select[Range[120], PalindromeQ[#+IntegerReverse[#]]&] (* Harvey P. Dale, Jul 04 2022 *)
PROG
(Haskell)
a015976 n = a015976_list !! (n-1)
a015976_list = filter ((== 1) . a136522 . a056964) [1..]
-- Reinhard Zumkeller, Oct 14 2011
CROSSREFS
KEYWORD
nonn,base,look
EXTENSIONS
Offset corrected by Reinhard Zumkeller, Oct 14 2011
STATUS
approved
Two 'Reverse and Add' steps are needed to reach a palindrome.
+10
4
19, 28, 37, 39, 46, 48, 49, 57, 58, 64, 67, 73, 75, 76, 82, 84, 85, 91, 93, 94, 109, 119, 129, 139, 149, 150, 152, 153, 154, 159, 160, 162, 163, 169, 170, 172, 173, 179, 189, 208, 218, 219, 228, 229, 238, 239, 248, 250, 251, 253, 258, 259, 260, 261, 268, 269
OFFSET
1,1
COMMENTS
The number of steps starts at 0, so palindromes (cf. A002113) are excluded.
LINKS
Michael S. Branicky, Table of n, a(n) for n = 1..10000 (terms 1..1000 from Harry J. Smith)
MATHEMATICA
trasQ[n_]:=Length[NestWhileList[IntegerReverse[#]+#&, n, !PalindromeQ[ #]&, 1, 5]] ==3; Select[Range[300], trasQ] (* Harvey P. Dale, Apr 13 2022 *)
PROG
(ARIBAS): revadd_steps(2, 58). For the definition of function revadd_steps see A065206.
(PARI)
Rev(x)= { local(d, r=0); while (x>0, d=x-10*(x\10); x\=10; r=r*10 + d); return(r) }
digitsIn(x)= { local(d); if (x==0, return(1)); d=1 + log(x)\log(10); if (10^d == x, d++, if (10^(d-1) > x, d--)); return(d) }
Palin(x)= { local(d, e, f, i, t, y); if (x==0, return(1)); y=x; d=digitsIn(x); t=10^(d - 1); for (i=1, d\2, f=y-10*(y\10); y\=10; e=x\t; x-=t*e; t/=10; if (e!=f, return(0)) ); return(1) }
{ n=0; for (m = 0, 10^9, p=m; b=1; for (i=1, 2, if (Palin(p), b=0; break); p=Rev(p) + p); if (b && Palin(p), write("b065207.txt", n++, " ", m); if (n==1000, return)) ) } \\ Harry J. Smith, Oct 14 2009
(Python)
def ra(n): s = str(n); return int(s) + int(s[::-1])
def ispal(n): s = str(n); return s == s[::-1]
def aupto(limit):
alst = []
for k in range(limit+1):
if ispal(k): continue
k2 = ra(k)
if ispal(k2): continue
if ispal(ra(k2)): alst.append(k)
return alst
print(aupto(269)) # Michael S. Branicky, May 06 2021
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Klaus Brockhaus, Oct 21 2001
EXTENSIONS
Offset changed from 0 to 1 by Harry J. Smith, Oct 14 2009
STATUS
approved
Three 'Reverse and Add' steps are needed to reach a palindrome.
+10
3
59, 68, 86, 95, 155, 156, 157, 158, 164, 165, 168, 178, 180, 184, 185, 186, 194, 199, 249, 254, 255, 256, 257, 263, 264, 267, 277, 283, 284, 285, 293, 298, 299, 348, 349, 354, 355, 356, 362, 366, 376, 382, 384, 389, 392, 397, 398, 399, 439, 447, 448, 449, 452, 453, 455, 461, 462, 465, 475, 481, 482, 483, 488, 489, 491, 496, 497, 498, 499, 538, 546, 547, 548, 551, 552, 553, 554, 560, 561, 564, 574, 580, 581, 582, 587, 588, 590, 596, 597, 598, 637, 645, 647, 650, 651, 652, 653, 660, 663, 673, 680, 681, 687, 694, 695, 697, 736, 744, 745, 746, 750
OFFSET
1,1
COMMENTS
The number of steps starts at 0, so palindromes (cf. A002113) are excluded.
MATHEMATICA
palQ[n_]:=Module[{idn=IntegerDigits[n]}, idn==Reverse[idn]]
tst[n_]:=palQ/@NestList[#+FromDigits[Reverse[IntegerDigits[#]]]&, n, 3]=={False, False, False, True}
Select[Range[750], tst] (* Harvey P. Dale, Nov 26 2010 *)
PROG
(ARIBAS): revadd_steps(3, 54). For the definition of function revadd_steps see A065206.
(PARI) Rev(x)= { local(d, r=0); while (x>0, d=x-10*(x\10); x\=10; r=r*10 + d); return(r) } digitsIn(x)= { local(d); if (x==0, return(1)); d=1 + log(x)\log(10); if (10^d == x, d++, if (10^(d-1) > x, d--)); return(d) } Palin(x)= { local(d, e, f, i, t, y); if (x==0, return(1)); y=x; d=digitsIn(x); t=10^(d - 1); for (i=1, d\2, f=y-10*(y\10); y\=10; e=x\t; x-=t*e; t/=10; if (e!=f, return(0)) ); return(1) } { n=0; for (m = 0, 10^9, p=m; b=1; for (i=1, 3, if (Palin(p), b=0; break); p=Rev(p) + p); if (b && Palin(p), write("b065208.txt", n++, " ", m); if (n==1000, return)) ) } \\ Harry J. Smith, Oct 14 2009
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Klaus Brockhaus, Oct 21 2001
EXTENSIONS
OFFSET changed from 0,1 to 1,1 by Harry J. Smith, Oct 14 2009
More terms from Harvey P. Dale, Nov 26 2010
STATUS
approved
Five 'Reverse and Add' steps are needed to reach a palindrome.
+10
3
166, 176, 198, 265, 275, 297, 364, 374, 396, 463, 473, 495, 549, 562, 572, 594, 639, 648, 661, 671, 693, 738, 760, 770, 792, 837, 846, 891, 936, 945, 990, 1396, 1486, 1576, 1666, 1697, 1756, 1787, 1791, 1793, 1796, 1846, 1877, 1883, 1886, 1890, 1936
OFFSET
1,1
COMMENTS
The number of steps starts at 0, so palindromes (cf. A002113) are excluded.
MATHEMATICA
palQ[k_]:=IntegerDigits[k]==Reverse[IntegerDigits[k]]; fraQ[n_]:= Module[ {ras=NestList[#+FromDigits[Reverse[IntegerDigits[#]]]&, n, 5]}, palQ/@ ras=={False, False, False, False, False, True}]; Select[Range[2000], fraQ] (* Harvey P. Dale, Sep 28 2015 *)
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Klaus Brockhaus, Oct 21 2001
EXTENSIONS
Offset changed to 1 by Harry J. Smith, Oct 14 2009
STATUS
approved
Seven 'Reverse and Add' steps are needed to reach a palindrome.
+10
3
188, 190, 197, 287, 296, 386, 395, 485, 584, 593, 683, 692, 782, 791, 881, 890, 980, 1394, 1484, 1574, 1664, 1754, 1844, 1898, 1934, 1988, 1992, 1994, 1999, 2393, 2483, 2573, 2663, 2753, 2843, 2897, 2933, 2987, 2991, 2993, 2998, 3089, 3179, 3269, 3359
OFFSET
1,1
COMMENTS
The number of steps starts at 0, so palindromes (cf. A002113) are excluded.
MATHEMATICA
lenQ[n_]:= Length[NestWhileList[# + FromDigits[Reverse[IntegerDigits[#]]]&, n, #!= FromDigits[Reverse[IntegerDigits[#]]]&, 1, 10]] == 8; Select[Range[500], lenQ] (* Vincenzo Librandi, Sep 24 2013 *)
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Klaus Brockhaus, Oct 21 2001
EXTENSIONS
OFFSET changed from 0,1 to 1,1 by Harry J. Smith, Oct 14 2009
STATUS
approved
Eight 'Reverse and Add' steps are needed to reach a palindrome.
+10
3
193, 391, 490, 589, 688, 886, 985, 1993, 1995, 2994, 3991, 4990, 4992, 5991, 6990, 8059, 8149, 8239, 8329, 8419, 8509, 8599, 8689, 8779, 8869, 8959, 9058, 9069, 9089, 9148, 9159, 9179, 9238, 9249, 9269, 9328, 9359, 9418, 9429, 9508, 9519, 9539, 9598
OFFSET
1,1
COMMENTS
The number of steps starts at 0, so palindromes (cf. A002113) are excluded.
MATHEMATICA
lenQ[n_]:=Length[NestWhileList[#+FromDigits[Reverse[IntegerDigits[#]]]&, n, #!=FromDigits[Reverse[IntegerDigits[#]]]&, 1, 10]]==9; Select[Range[ 10000], lenQ] (* Harvey P. Dale, Aug 09 2013 *)
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Klaus Brockhaus, Oct 21 2001
EXTENSIONS
OFFSET changed from 0,1 to 1,1 by Harry J. Smith, Oct 14 2009
STATUS
approved
Numbers n such that nine 'Reverse and Add' steps are needed to reach a palindrome.
+10
3
1397, 1487, 1577, 1667, 1757, 1847, 1937, 2396, 2486, 2576, 2666, 2756, 2846, 2936, 2999, 3395, 3485, 3575, 3665, 3755, 3845, 3935, 3998, 4394, 4484, 4574, 4754, 4844, 4934, 4997, 5393, 5483, 5573, 5663, 5753, 5843, 5933, 5996, 6392, 6482, 6572
OFFSET
1,1
COMMENTS
The number of steps starts at 0, so palindromes (cf. A002113) are excluded.
MATHEMATICA
lenQ[n_]:= Length[NestWhileList[# + FromDigits[Reverse[IntegerDigits[#]]]&, n, #!= FromDigits[Reverse[IntegerDigits[#]]]&, 1, 10]] == 10; Select[Range[1000], lenQ] (* Vincenzo Librandi, Sep 24 2013 *)
CROSSREFS
Cf. A002113, A065206. Different from A015990.
KEYWORD
nonn,base
AUTHOR
Klaus Brockhaus, Oct 21 2001
STATUS
approved
Numbers such that ten 'Reverse and Add' steps are needed to reach a palindrome.
+10
3
829, 928, 9059, 9149, 9239, 9329, 9419, 9509, 9599, 9689, 9869, 9959, 10634, 10637, 10687, 10716, 10808, 10834, 10838, 10867, 10873, 10898, 10927, 10979, 11398, 11624, 11627, 11677, 11706, 11824, 11828, 11857, 11863, 11888, 11917, 11969
OFFSET
1,1
COMMENTS
The number of steps starts at 0, so palindromes (cf. A002113) are excluded.
MATHEMATICA
lenQ[n_]:= Length[NestWhileList[# + FromDigits[Reverse[IntegerDigits[#]]]&, n, #!= FromDigits[Reverse[IntegerDigits[#]]]&, 1, 11]] == 11; Select[Range[1000], lenQ] (* Vincenzo Librandi, Sep 24 2013 *)
CROSSREFS
Cf. A002113, A015991 (a different version), A065206.
KEYWORD
nonn,base
AUTHOR
Klaus Brockhaus, Oct 21 2001
STATUS
approved
Eleven 'Reverse and Add' steps are needed to reach a palindrome.
+10
3
167, 266, 365, 563, 662, 761, 860, 7069, 7159, 7249, 7339, 7429, 7519, 7609, 7699, 7789, 7879, 7969, 8068, 8158, 8248, 8428, 8518, 8608, 8698, 8788, 8878, 8968, 9039, 9067, 9129, 9157, 9219, 9247, 9309, 9337, 9399, 9427, 9489, 9517, 9579, 9607, 9697
OFFSET
1,1
COMMENTS
The number of steps starts at 0, so palindromes (cf. A002113) are excluded.
MATHEMATICA
lenQ[n_]:= Length[NestWhileList[# + FromDigits[Reverse[IntegerDigits[#]]]&, n, #!= FromDigits[Reverse[IntegerDigits[#]]]&, 1, 12]] == 12; Select[Range[1000], lenQ] (* Vincenzo Librandi, Sep 24 2013 *)
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Klaus Brockhaus, Oct 21 2001
EXTENSIONS
OFFSET changed from 0,1 to 1,1 by Harry J. Smith, Oct 14 2009
STATUS
approved

Search completed in 0.010 seconds