cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-10 of 70 results. Next

A298509 First differences of A023108.

Original entry on oeis.org

99, 99, 99, 99, 97, 2, 97, 2, 89, 8, 91, 8, 509, 2, 88, 2, 88, 2, 88, 2, 88, 2, 88, 2, 50, 497, 2, 88, 2, 88, 2, 88, 2, 88, 2, 88, 2, 50, 497, 2, 88, 2, 88, 2, 88, 2, 88, 2, 88, 2
Offset: 1

Views

Author

Alessandro Polcini, Jan 20 2018

Keywords

Comments

It appears that this sequence has a very regular pattern, as shown by the attached .png graphical visualization.

Crossrefs

Cf. A023108.

A306359 a(n) is the seed as given in A063048 such that the Lychrel number in A023108(n) joins the trajectory of this seed; 0 if A023108(n) is a seed.

Original entry on oeis.org

0, 196, 196, 196, 196, 196, 196, 196, 196, 0, 196, 879, 196, 196, 879, 196, 879, 196, 879, 196, 879, 196, 879, 196, 879, 0, 196, 879, 196, 879, 196, 879, 196, 879, 196, 879, 196, 879, 1997, 196, 879, 196, 879, 196, 879, 196, 879, 196, 879, 196, 879, 1997, 196, 196, 196, 196, 196, 196, 879, 196, 196, 879, 196, 196, 879
Offset: 1

Views

Author

A.H.M. Smeets, Feb 10 2019

Keywords

Comments

If A023108(n) in A063048 then a(n) = 0 else a(n) in A063048.

Crossrefs

A135316 Primes in A023108(n); or Lychrel primes.

Original entry on oeis.org

691, 887, 1997, 3583, 3673, 3853, 3943, 4079, 4259, 4349, 4799, 4889, 5581, 5851, 6257, 6977, 8089, 8179, 8269, 8539, 8629, 8719, 10663, 10883, 11777, 11833, 11867, 11923, 11953, 11959, 12097, 12763, 12823, 13397, 13523, 13553, 13597, 13633
Offset: 1

Views

Author

Alexander Adamchuk, Dec 05 2007

Keywords

Comments

A023108(n) = Positive integers which apparently never result in a palindrome under repeated applications of the function f(x) = x + (x with digits reversed).

Examples

			A023108(n) begins {196, 295, 394, 493, 592, 689, 691, 788, 790, 879, 887, ...}.
Thus a(1) = 691 which is the first prime in A023108(n), a(2) = 887 which is the second prime in A023108(n).
		

Crossrefs

Extensions

More terms from Dmitry Kamenetsky, May 04 2009

A002113 Palindromes in base 10.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 22, 33, 44, 55, 66, 77, 88, 99, 101, 111, 121, 131, 141, 151, 161, 171, 181, 191, 202, 212, 222, 232, 242, 252, 262, 272, 282, 292, 303, 313, 323, 333, 343, 353, 363, 373, 383, 393, 404, 414, 424, 434, 444, 454, 464, 474, 484, 494, 505, 515
Offset: 1

Views

Author

Keywords

Comments

n is a palindrome (i.e., a(k) = n for some k) if and only if n = A004086(n). - Reinhard Zumkeller, Mar 10 2002
It seems that if n*reversal(n) is in the sequence then n = 3 or all digits of n are less than 3. - Farideh Firoozbakht, Nov 02 2014
The position of a palindrome within the sequence can be determined almost without calculation: If the palindrome has an even number of digits, prepend a 1 to the front half of the palindrome's digits. If the number of digits is odd, prepend the value of front digit + 1 to the digits from position 2 ... central digit. Examples: 98766789 = a(19876), 515 = a(61), 8206028 = a(9206), 9230329 = a(10230). - Hugo Pfoertner, Aug 14 2015
This sequence is an additive basis of order at most 49, see Banks link. - Charles R Greathouse IV, Aug 23 2015
The order has been reduced from 49 to 3; see the Cilleruelo-Luca and Cilleruelo-Luca-Baxter links. - Jonathan Sondow, Nov 27 2017
See A262038 for the "next palindrome" and A261423 for the "preceding palindrome" functions. - M. F. Hasler, Sep 09 2015
The number of palindromes with d digits is 10 if d = 1, and otherwise it is 9 * 10^(floor((d - 1)/2)). - N. J. A. Sloane, Dec 06 2015
Sequence A033665 tells how many iterations of the Reverse-then-add function A056964 are needed to reach a palindrome; numbers for which this will never happen are Lychrel numbers (A088753) or rather Kin numbers (A023108). - M. F. Hasler, Apr 13 2019
This sequence is an additive basis of order 3, see Cilleruelo, Luca, & Baxter and Sigg. - Charles R Greathouse IV, Apr 08 2025

References

  • Karl G. Kröber, "Palindrome, Perioden und Chaoten: 66 Streifzüge durch die palindromischen Gefilde" (1997, Deutsch-Taschenbücher; Bd. 99) ISBN 3-8171-1522-9.
  • Clifford A. Pickover, A Passion for Mathematics, Wiley, 2005; see p. 71.
  • Alfred S. Posamentier, Math Charmers, Tantalizing Tidbits for the Mind, Prometheus Books, NY, 2003, pages 50-52.
  • Paulo Ribenboim, The Little Book of Bigger Primes, Springer-Verlag NY 2004. See p. 120.
  • N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Subsequence of A061917 and A221221.
A110745 is a subsequence.
Union of A056524 and A056525.
Palindromes in bases 2 through 11: A006995 and A057148, A014190 and A118594, A014192 and A118595, A029952 and A118596, A029953 and A118597, A029954 and A118598, A029803 and A118599, A029955 and A118600, this sequence, A029956. Also A262065 (base 60), A262069 (subsequence).
Palindromic primes: A002385. Palindromic nonprimes: A032350.
Palindromic-pi: A136687.
Cf. A029742 (complement), A086862 (first differences).
Palindromic floor function: A261423, also A261424. Palindromic ceiling: A262038.
Cf. A004086 (read n backwards), A064834, A118031, A136522 (characteristic function), A178788.
Ways to write n as a sum of three palindromes: A261132, A261422.
Minimal number of palindromes that add to n using greedy algorithm: A088601.
Minimal number of palindromes that add to n: A261675.

Programs

  • GAP
    Filtered([0..550],n->ListOfDigits(n)=Reversed(ListOfDigits(n))); # Muniru A Asiru, Mar 08 2019
    
  • Haskell
    a002113 n = a002113_list !! (n-1)
      a002113_list = filter ((== 1) . a136522) [1..] -- Reinhard Zumkeller, Oct 09 2011
    
  • Haskell
    import Data.List.Ordered (union)
      a002113_list = union a056524_list a056525_list -- Reinhard Zumkeller, Jul 29 2015, Dec 28 2011
    
  • Magma
    [n: n in [0..600] | Intseq(n, 10) eq Reverse(Intseq(n, 10))]; // Vincenzo Librandi, Nov 03 2014
    
  • Maple
    read transforms; t0:=[]; for n from 0 to 2000 do if digrev(n) = n then t0:=[op(t0),n]; fi; od: t0;
    # Alternatively, to get all palindromes with <= N digits in the list "Res":
    N:=5;
    Res:= $0..9:
    for d from 2 to N do
      if d::even then
        m:= d/2;
        Res:= Res, seq(n*10^m + digrev(n),n=10^(m-1)..10^m-1);
      else
        m:= (d-1)/2;
        Res:= Res, seq(seq(n*10^(m+1)+y*10^m+digrev(n),y=0..9),n=10^(m-1)..10^m-1);
      fi
    od: Res:=[Res]: # Robert Israel, Aug 10 2014
    # A variant: Gets all base-10 palindromes with exactly d digits, in the list "Res"
    d:=4:
    if d=1 then Res:= [$0..9]:
    elif d::even then
        m:= d/2:
        Res:= [seq(n*10^m + digrev(n), n=10^(m-1)..10^m-1)]:
    else
        m:= (d-1)/2:
        Res:= [seq(seq(n*10^(m+1)+y*10^m+digrev(n), y=0..9), n=10^(m-1)..10^m-1)]:
    fi:
    Res; # N. J. A. Sloane, Oct 18 2015
    isA002113 := proc(n)
        simplify(digrev(n) = n) ;
    end proc: # R. J. Mathar, Sep 09 2015
  • Mathematica
    palQ[n_Integer, base_Integer] := Module[{idn = IntegerDigits[n, base]}, idn == Reverse[idn]]; (* then to generate any base-b sequence for 1 < b < 37, replace the 10 in the following instruction with b: *) Select[Range[0, 1000], palQ[#, 10] &]
    base10Pals = {0}; r = 2; Do[Do[AppendTo[base10Pals, n * 10^(IntegerLength[n] - 1) + FromDigits@Rest@Reverse@IntegerDigits[n]], {n, 10^(e - 1), 10^e - 1}]; Do[AppendTo[base10Pals, n * 10^IntegerLength[n] + FromDigits@Reverse@IntegerDigits[n]], {n, 10^(e - 1), 10^e - 1}], {e, r}]; base10Pals (* Arkadiusz Wesolowski, May 04 2012 *)
    nthPalindromeBase[n_, b_] := Block[{q = n + 1 - b^Floor[Log[b, n + 1 - b^Floor[Log[b, n/b]]]], c = Sum[Floor[Floor[n/((b + 1) b^(k - 1) - 1)]/(Floor[n/((b + 1) b^(k - 1) - 1)] - 1/b)] - Floor[Floor[n/(2 b^k - 1)]/(Floor[n/(2 b^k - 1)] - 1/ b)], {k, Floor[Log[b, n]]}]}, Mod[q, b] (b + 1)^c * b^Floor[Log[b, q]] + Sum[Floor[Mod[q, b^(k + 1)]/b^k] b^(Floor[Log[b, q]] - k) (b^(2 k + c) + 1), {k, Floor[Log[b, q]]}]] (* after the work of Eric A. Schmidt, works for all integer bases b > 2 *)
    Array[nthPalindromeBase[#, 10] &, 61, 0] (* please note that Schmidt uses a different, a more natural and intuitive offset, that of a(1) = 1. - Robert G. Wilson v, Sep 22 2014 and modified Nov 28 2014 *)
    Select[Range[10^3], PalindromeQ] (* Michael De Vlieger, Nov 27 2017 *)
    nLP[cn_Integer]:=Module[{s,len,half,left,pal,fdpal},s=IntegerDigits[cn]; len=Length[s]; half=Ceiling[len/2]; left=Take[s,half]; pal=Join[left,Reverse[ Take[left,Floor[len/2]]]]; fdpal=FromDigits[pal]; Which[cn==9,11,fdpal>cn,fdpal,True,left=IntegerDigits[ FromDigits[left]+1]; pal=Join[left,Reverse[Take[left,Floor[len/2]]]]; FromDigits[pal]]]; NestList[nLP,0,100] (* Harvey P. Dale, Dec 10 2024 *)
  • PARI
    is_A002113(n)=Vecrev(n=digits(n))==n \\ M. F. Hasler, Nov 17 2008, updated Apr 26 2014, Jun 19 2018
    
  • PARI
    is(n)=n=digits(n);for(i=1,#n\2,if(n[i]!=n[#n+1-i],return(0))); 1 \\ Charles R Greathouse IV, Jan 04 2013
    
  • PARI
    a(n)={my(d,i,r);r=vector(#digits(n-10^(#digits(n\11)))+#digits(n\11));n=n-10^(#digits(n\11));d=digits(n);for(i=1,#d,r[i]=d[i];r[#r+1-i]=d[i]);sum(i=1,#r,10^(#r-i)*r[i])} \\ David A. Corneth, Jun 06 2014
    
  • PARI
    \\ recursive--feed an element a(n) and it gives a(n+1)
    nxt(n)=my(d=digits(n));i=(#d+1)\2;while(i&&d[i]==9,d[i]=0;d[#d+1-i]=0;i--);if(i,d[i]++;d[#d+1-i]=d[i],d=vector(#d+1);d[1]=d[#d]=1);sum(i=1,#d,10^(#d-i)*d[i]) \\ David A. Corneth, Jun 06 2014
    
  • PARI
    \\ feed a(n), returns n.
    inv(n)={my(d=digits(n));q=ceil(#d/2);sum(i=1,q,10^(q-i)*d[i])+10^floor(#d/2)} \\ David A. Corneth, Jun 18 2014
    
  • PARI
    inv_A002113(P)={P\(P=10^(logint(P+!P,10)\/2))+P} \\ index n of palindrome P = a(n), much faster than above: no sum is needed. - M. F. Hasler, Sep 09 2018
    
  • PARI
    A002113(n,L=logint(n,10))=(n-=L=10^max(L-(n<11*10^(L-1)),0))*L+fromdigits(Vecrev(digits(if(nM. F. Hasler, Sep 11 2018
    
  • Python
    # edited by M. F. Hasler, Jun 19 2018
    def A002113_list(nMax):
      mlist=[]
      for n in range(nMax+1):
         mstr=str(n)
         if mstr==mstr[::-1]:
            mlist.append(n)
      return mlist # Bill McEachen, Dec 17 2010
    
  • Python
    from itertools import chain
    A002113 = sorted(chain(map(lambda x:int(str(x)+str(x)[::-1]),range(1,10**3)),map(lambda x:int(str(x)+str(x)[-2::-1]), range(10**3)))) # Chai Wah Wu, Aug 09 2014
    
  • Python
    from itertools import chain, count
    A002113 = chain(k for k in count(0) if str(k) == str(k)[::-1])
    print([next(A002113) for k in range(60)]) # Jan P. Hartkopf, Apr 10 2021
    
  • Python
    is_A002113 = lambda n: (s:=str(n))[::-1]==s # M. F. Hasler, May 23 2024
    
  • Python
    from math import log10, floor
    def A002113(n):
      if n < 2: return 0
      P = 10**floor(log10(n//2)); M = 11*P
      s = str(n - (P if n < M else M-P))
      return int(s + s[-2 if n < M else -1::-1]) # M. F. Hasler, Jun 06 2024
    
  • SageMath
    [n for n in (0..515) if Word(n.digits()).is_palindrome()] # Peter Luschny, Sep 13 2018
    
  • Scala
    def palQ(n: Int, b: Int = 10): Boolean = n - Integer.parseInt(n.toString.reverse) == 0
    (0 to 999).filter(palQ()) // _Alonso del Arte, Nov 10 2019

Formula

A136522(a(n)) = 1.
A178788(a(n)) = 0 for n > 9. - Reinhard Zumkeller, Jun 30 2010
A064834(a(n)) = 0. - Reinhard Zumkeller, Sep 18 2013
a(n+1) = A262038(a(n)+1). - M. F. Hasler, Sep 09 2015
Sum_{n>=2} 1/a(n) = A118031. - Amiram Eldar, Oct 17 2020
a(n) = (floor(d(n)/(c(n)*9 + 1)))*10^A055642(d(n)) + A004086(d(n)) where b(n, k) = ceiling(log((n + 1)/k)/log(10)), c(n) = b(n, 2) - b(n, 11) and d(n) = (n - A086573(b(n*(2 - c(n)), 2) - 1)/2 - 1). - Alan Michael Gómez Calderón, Mar 11 2025

A056964 a(n) = n + reversal of digits of n.

Original entry on oeis.org

0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 11, 22, 33, 44, 55, 66, 77, 88, 99, 110, 22, 33, 44, 55, 66, 77, 88, 99, 110, 121, 33, 44, 55, 66, 77, 88, 99, 110, 121, 132, 44, 55, 66, 77, 88, 99, 110, 121, 132, 143, 55, 66, 77, 88, 99, 110, 121, 132, 143, 154, 66, 77, 88, 99, 110
Offset: 0

Views

Author

Henry Bottomley, Jul 18 2000

Keywords

Comments

If n has an even number of digits then a(n) is a multiple of 11.
Also called the Reverse and Add!, or RADD operation. Iteration of this function leads to the definition of Lychrel and related numbers, cf. A023108, A063048, A088753, A006960, and many others. - M. F. Hasler, Apr 13 2019

Examples

			a(17) = 17 + 71 = 88.
		

Crossrefs

Differs from A052008 when n=101 and a(101)=202 while A052008(101)=121
Cf. A036839.

Programs

Formula

a(n) = n + A004086(n) = 2*n - A056965(n).
n < a(n) < 11n for n > 0. - Charles R Greathouse IV, Nov 17 2022

A006960 Reverse and Add! sequence starting with 196.

Original entry on oeis.org

196, 887, 1675, 7436, 13783, 52514, 94039, 187088, 1067869, 10755470, 18211171, 35322452, 60744805, 111589511, 227574622, 454050344, 897100798, 1794102596, 8746117567, 16403234045, 70446464506, 130992928913, 450822227944, 900544455998, 1800098901007, 8801197801088, 17602285712176
Offset: 0

Views

Author

Keywords

Comments

196 is conjectured to be the smallest initial term which does not lead to a palindrome. John Walker, Tim Irvin and others have extended the trajectory of 196 to millions of digits without finding a palindrome.
From A.H.M. Smeets, Jan 31 2019: (Start)
Palindromes for a(9)/2, a(14)/2 and a(20)/2.
Observed: It seems that most, but not all, Lychrel numbers (seeds given in A063048) have a trajectory term that, divided by 2, becomes palindromic. Note that 196 is the first Lychrel number (A063048(1)). (End)
Observed: On average, 0.414 digits are gained by each step of the reverse and add procedure; i.e., 2.416 steps are needed on average to gain a factor of 10. This holds for any trajectory of reverse and add for decimal number representation. - A.H.M. Smeets, Feb 03 2019

Examples

			From _M. F. Hasler_, Apr 13 2019: (Start)
Start with 196 = a(0), then:
A056964(196) = 196 + 691 = 887 = a(1); then:
A056964(887) = 887 + 788 = 1675 = a(2); then:
A056964(1675) = 1675 + 5761 = 7436 = a(3); then:
A056964(7436) = 7436 + 6347 = 13783 = a(4); then:
A056964(13783) = 13783 + 38731 = 52514 = a(5); etc. (End)
		

References

  • J.-M. De Koninck, Ces nombres qui nous fascinent, Entry 196, p. 58, Ellipses, Paris 2008.
  • D. H. Lehmer, "Sujets d'étude. No. 74," Sphinx (Bruxelles), 8 (1938), 12-13. (This is the currently earliest known reference to the 196 Problem). - James D. Klein, Apr 09 2012
  • Daniel Lignon, Dictionnaire de (presque) tous les nombres entiers, Ellipses, Paris, 2012, 702 pages. See Entry 196.
  • Clifford A. Pickover, A Passion for Mathematics, Wiley, 2005; see p. 70.
  • Popular Computing (Calabasas, CA), The 196 Problem, Vol. 3 (No. 30, Sep 1975), pages PC30-6 to PC30-9.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Programs

  • Haskell
    a006960 n = a006960_list !! n
    a006960_list = iterate a056964 196 -- Reinhard Zumkeller, Sep 22 2011
    
  • Maple
    a:= proc(n) option remember; `if`(n=0, 196, (h-> h+ (s->
          parse(cat(s[-i]$i=1..length(s))))(""||h))(a(n-1)))
        end:
    seq(a(n), n=0..40);  # Alois P. Heinz, Jul 25 2014
  • Mathematica
    a = {196}; For[i = 2, i < 26, i++, a = Append[a, a[[i - 1]] + ToExpression[ StringReverse[ToString[a[[i - 1]]]]]]]; a
    NestList[#+FromDigits[Reverse[IntegerDigits[#]]]&,196,25] (* Harvey P. Dale, Jun 05 2011 *)
    NestList[#+IntegerReverse[#]&,196,25] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Jan 04 2019 *)
  • PARI
    A006960_vec(N=99)=vector(N,i,N=if(i>1,A056964(N),196)) \\ M. F. Hasler, Apr 13 2019

Formula

a(n+1) = A056964(a(n)). - A.H.M. Smeets, Jan 27 2019

Extensions

More terms from Vit Planocka (planocka(AT)mistral.cz), Sep 28 2002

A033865 Start with n; if palindrome, stop; otherwise add to itself with digits reversed; a(n) gives palindrome at which it stops, or -1 if no palindrome is ever reached.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 11, 33, 44, 55, 66, 77, 88, 99, 121, 22, 33, 22, 55, 66, 77, 88, 99, 121, 121, 33, 44, 55, 33, 77, 88, 99, 121, 121, 363, 44, 55, 66, 77, 44, 99, 121, 121, 363, 484, 55, 66, 77, 88, 99, 55, 121, 363, 484, 1111, 66, 77, 88, 99, 121, 121, 66, 484, 1111, 4884, 77, 88, 99, 121, 121, 363, 484, 77, 4884, 44044, 88
Offset: 0

Views

Author

Keywords

Comments

It is believed that a(196) = -1.

Examples

			19 -> 19 + 91 = 110 -> 110 + 011 = 121, so a(19) = 121.
		

References

  • M. Donner, I Love Me, Vol. I: S. Wordrow's palindromic encyclopedia (Algonquin Books, 1996) p. 268

Crossrefs

Cf. A061563, A016016, A023109, A006960, A023108, A002113, A033665 (number of steps).

Programs

  • ARIBAS
    var st: stack; end; for k := 0 to 60 do n := k; while n <> int_reverse(n) do n := n + int_reverse(n); end; stack_push(st,n); end; stack2array(st);
    
  • Mathematica
    Table[NestWhile[# + FromDigits[Reverse[IntegerDigits[#]]] &, n, IntegerDigits[#] != Reverse[IntegerDigits[#]] &], {n, 0, 90}] (* Harvey P. Dale, Dec 18 2011 *)
  • PARI
    a(n)=my(k); while((k=fromdigits(Vecrev(digits(n)))) != n, n += k); n \\ infinite loop if a(n) = -1; Charles R Greathouse IV, Dec 13 2015

Extensions

More terms from Jenise Smalley (neicey01(AT)hotmail.com), Oct 18 2001

A033665 Number of 'Reverse and Add' steps needed to reach a palindrome starting at n, or -1 if n never reaches a palindrome.

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 0, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 0, 1, 1, 1, 2, 1, 2, 1, 1, 1, 1, 0, 1, 2, 1, 2, 2, 1, 1, 1, 1, 1, 0, 1, 2, 2, 3, 1, 1, 1, 1, 2, 1, 0, 2, 3, 4, 1, 1, 1, 2, 1, 2, 2, 0, 4, 6, 1, 1, 2, 1, 2, 2, 3, 4, 0, 24, 1, 2, 1, 2, 2, 3, 4, 6, 24, 0, 1, 0, 1, 1
Offset: 0

Views

Author

Keywords

Comments

Palindromes themselves are not 'Reverse and Add!'ed, so they yield a zero!
Numbers n that may have a(n) = -1 (i.e., potential Lychrel numbers) appear in A023108. - Michael De Vlieger, Jan 11 2018
Record indices and values are given in A065198 and A065199. - M. F. Hasler, Feb 16 2020

Examples

			19 -> 19+91 = 110 -> 110+011 = 121 = palindrome, took 2 steps, so a(19)=2.
n = 89 needs 24 steps to end up with the palindrome 8813200023188. See A240510. - _Wolfdieter Lang_, Jan 12 2018
		

References

  • D. Wells, The Penguin Dictionary of Curious and Interesting Numbers Penguin Books, 1987, pp. 142-143.

Crossrefs

Equals A030547(n) - 1.
Cf. A065198, A065199 (record indices & values).

Programs

  • Mathematica
    rev[n_]:=FromDigits[Reverse[IntegerDigits[n]]];radd[n_]:=n+rev[n];
    pal[n_]:=If[n==rev[n],True,False];
    raddN[n_]:=Length[NestWhileList[radd[#]&,n,pal[#]==False&]]-1;
    raddN/@Range[0,195] (* Ivan N. Ianakiev, Aug 31 2015 *)
    With[{nn = 10^3}, Array[-1 + Length@ NestWhileList[# + IntegerReverse@ # &, #, !PalindromeQ@ # &, 1, nn] /. k_ /; k == nn -> -1 &, 200]] (* Michael De Vlieger, Jan 11 2018 *)
  • PARI
    rev(n)={d=digits(n);p="";for(i=1,#d,p=concat(Str(d[i]),p));return(eval(p))}
    a(n)=if(n==rev(n),return(0));for(k=1,10^3,i=n+rev(n);if(rev(i)==i,return(k));n=i)
    n=0;while(n<100,print1(a(n),", ");n++) \\ Derek Orr, Jul 28 2014
    
  • PARI
    A033665(n,LIM=333)={-!for(i=0,LIM,my(r=A004086(n)); n==r&&return(i); n+=r)} \\ with {A004086(n)=fromdigits(Vecrev(digits(n)))}. The second optional arg is a search limit that could be taken smaller up to very large n, e.g., 99 for n < 10^9, 200 for n < 10^14, 250 for n < 10^18: see A065199 for the records and A065198 for the n's. - M. F. Hasler, Apr 13 2019, edited Feb 16 2020
    
  • Python
    A033665 = lambda n, LIM=333: next((i for i in range(LIM) if is_A002113(n) or not(n := A004086(n)+n)), -1) # The second, optional argument is a search limit, see above. - M. F. Hasler, May 23 2024

Extensions

More terms from Patrick De Geest, Jun 15 1998
I truncated the b-file at n=195, since the value of a(196) is not presently known (cf. A006960). The old b-files are now a-files. - N. J. A. Sloane, May 09 2015

A063048 Numbers n such that the Reverse and Add! trajectory of n (presumably) does not reach a palindrome and does not join the trajectory of any term m < n.

Original entry on oeis.org

196, 879, 1997, 7059, 10553, 10563, 10577, 10583, 10585, 10638, 10663, 10668, 10697, 10715, 10728, 10735, 10746, 10748, 10783, 10785, 10787, 10788, 10877, 10883, 10963, 10965, 10969, 10977, 10983, 10985, 12797, 12898, 13097, 13197, 13694
Offset: 1

Views

Author

Klaus Brockhaus, Jul 07 2001, revised Nov 04 2003

Keywords

Comments

The starting number n is regarded as part of the trajectory, so palindromes are excluded from the sequence. A088753 is obtained if palindromes are not excluded. The smallest term in A063048 but not in A088753 is 19098, the smallest term in A088753 but not in A063048 is 9999.
Subsequence of A023108. Sequence A070788 is similarly defined, but palindromes are irrelevant. Corresponding sequences for other bases are A075252 (base 2), A077405 (base 3), A075421 (base 4).
If the trajectory of a number k joins the trajectory of a smaller number which is a term of the present sequence, then this occurs after very few Reverse and Add! steps (at most 8 for k < 100000, at most 10 for k < 1000000). On the other hand, the trajectories of the terms < 14000 do not join the trajectory of any smaller term within at least 1500 steps. This is the precise meaning of "presumably" in the definition.
The terms are rather unevenly distributed. They form clusters, especially above 10^4, 10^5, 10^6, ... . The interval from 10000 to 11000 for example contains 26 terms, whereas only two terms occur in the interval from 90000 to 100000.
It seems that if the most significant digit is not equal to 1, the least significant digit is always 9, while this does not hold for the Lychrel numbers as in A023108. - A.H.M. Smeets, Feb 18 2019
From A.H.M. Smeets, Sep 18 2021: (Start)
Let d_0 d_1 d_2 ... d_n be the decimal digits of an (n+1)-digit number.
All numbers in this sequence seem to satisfy the following condition:
d_0 = "1" or d_n = "9", and for all k, 0 < k < floor((n-1)/2), d_k = "0" or d_k = "9" or d_(n-k) = "0" or d_(n-k) = "9".
The plot log_10(a(n)) versus log_10(n) shows a stepwise behavior. However, the global behavior seems to be a straight line with slope e/(e-1) (= A185393). This slope is also obtained for the seeds in the Reverse and Add! problem in other bases. (End)

Examples

			1997 is a term since the trajectory of 1997 (presumably) does not lead to a number which occurs in the trajectory of 196 or of 879 (actually checked for the first 10000 terms of these trajectories). The trajectory of 1997 joins the trajectory of 106 at 97768 (cf. A070796), but 106 is not a term of the present sequence.
		

References

  • Daniel Lignon, Dictionnaire de (presque) tous les nombres entiers, Ellipses, Paris, 2012, 702 pages. See Entry 196.

Crossrefs

Programs

  • Mathematica
    limit = 10^3; (* Assumes that there is no palindrome if none is found before "limit" iterations *)
    utraj = {};
    Select[Range[0, 14000], (x = NestWhileList[ # + IntegerReverse[#] &, #, ! PalindromeQ[#] &, 1, limit];
       If[Length[x] >= limit && Intersection[x, utraj] == {},
        utraj = Union[utraj, x]; True,
    utraj = Union[utraj, x]]) &] (* Robert Price, Oct 16 2019 *)

A058042 Trajectory of binary number 10110 under the operation 'Reverse and Add!' carried out in base 2.

Original entry on oeis.org

10110, 100011, 1010100, 1101001, 10110100, 11100001, 101101000, 110010101, 1011101000, 1101000101, 10111010000, 11000101101, 101111010000, 110010001101, 1011110100000, 1100001011101, 10111110100000
Offset: 0

Views

Author

N. J. A. Sloane, May 18 2001

Keywords

Comments

According to J. Walker, Ronald Sprague has proved that this trajectory does not contain a palindrome. [I would like a reference for this.] Another proof has been given by Klaus Brockhaus.
10110 is the smallest number with this property in base 2. The analogous number in base 10 is believed to be 196, but its trajectory (see A006960) has never been proved not to contain a palindrome.
The binary numbers have a regular pattern with cycle length 4:
a(4k) = 101^(k+1)010^(k+1) for k >= 1,
a(4k+1) = 1101^(k-1)0001^(k-1)01 for k >= 2,
a(4k+2) = 101^(k+1)010^(k+2) for k >= 0,
a(4k+3) = 110^(k+1)101^(k)01 for k >= 1, where ^ stands for repeated concatenation. - A.H.M. Smeets, Feb 03 2019
From A.H.M. Smeets, Feb 11 2019: (Start)
Pattern with cycle length 4 represented by contextfree grammars with production rules:
S_a -> 10 T_a 00, T_a -> 1 T_a 0 | 1101;
S_b -> 11 T_b 01, T_b -> 0 T_b 1 | 1000;
S_c -> 10 T_c 000, T_c -> 1 T_c 0 | 1101;
S_d -> 11 T_d 101, T_d -> 0 T_d 1 | 0010;
see also A058042 for similar grammars for the binary represented trajectory of 77. (End)

Crossrefs

See A061561 for the terms of A058042 written in base 10. Cf. A016016, A006960, A023108.

Programs

  • ARIBAS
    var m,c,rev: integer; end; m := 22; c := 1; bit_write(m); write(" "); rev := bit_reverse(m); while m <> rev and c < 25 do inc(c); m := m + rev; bit_write(m); write(" "); rev := bit_reverse(m); end;
    
  • Haskell
    a058042 = a007088 . a061561  -- Reinhard Zumkeller, Apr 21 2013
  • Mathematica
    Clear[a]; a[0] = 10110; a[n_] := a[n] = (m = IntegerDigits[ a[n-1] ]; m2 = FromDigits[m, 2]; IntegerDigits[ FromDigits[m // Reverse, 2] + m2, 2] // FromDigits); Table[a[n], {n, 0, 16}] (* Jean-François Alcover, Apr 03 2013 *)

Formula

a(n) = A007088(A061561(n)). - Reinhard Zumkeller, Apr 21 2013

Extensions

More terms from Klaus Brockhaus, May 27 2001
Showing 1-10 of 70 results. Next