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 33 results. Next

A355695 a(n) is the smallest number that has exactly n nonpalindromic divisors (A029742).

Original entry on oeis.org

1, 10, 20, 30, 48, 72, 60, 140, 144, 120, 210, 180, 300, 240, 560, 504, 360, 420, 780, 1764, 900, 960, 720, 1200, 840, 1560, 2640, 1260, 1440, 2400, 3900, 3024, 1680, 3120, 2880, 4800, 7056, 3600, 2520, 3780, 3360, 5460, 6480, 16848, 6300, 8820, 7200, 9240, 6720, 12480, 5040
Offset: 0

Views

Author

Bernard Schott, Jul 14 2022

Keywords

Examples

			48 has 10 divisors: {1, 2, 3, 4, 6, 8, 12, 16, 24, 48}, only 12, 16, 24 and 48 are nonpalindromic; no positive integer smaller than 48 has four nonpalindromic divisors, hence a(4) = 48.
		

Crossrefs

Similar sequences: A087997, A333456, A355303, A355594.

Programs

  • Mathematica
    f[n_] := DivisorSum[n, 1 &, ! PalindromeQ[#] &]; seq[len_, nmax_] := Module[{s = Table[0, {len}], c = 0, n = 1, i}, While[c < len && n < nmax, i = f[n] + 1; If[i <= len && s[[i]] == 0, c++; s[[i]] = n]; n++]; s]; seq[50, 10^5] (* Amiram Eldar, Jul 14 2022 *)
  • PARI
    isnp(n) = my(d=digits(n)); d!=Vecrev(d); \\ A029742
    a(n) = my(k=1); while (sumdiv(k, d, isnp(d)) != n, k++); k; \\ Michel Marcus, Jul 14 2022
    
  • Python
    from sympy import divisors
    from itertools import count, islice
    def c(n): s = str(n); return s != s[::-1]
    def f(n): return sum(1 for d in divisors(n, generator=True) if c(d))
    def agen():
        n, adict = 0, dict()
        for k in count(1):
            fk = f(k)
            if fk not in adict: adict[fk] = k
            while n in adict: yield adict[n]; n += 1
    print(list(islice(agen(), 51))) # Michael S. Branicky, Jul 27 2022

Extensions

More terms from Michel Marcus, Jul 14 2022

A357045 Lexicographically earliest sequence of distinct non-palindromic numbers (A029742) such that a(n)+a(n+1) is always a palindrome (A002113).

Original entry on oeis.org

10, 12, 21, 23, 32, 34, 43, 45, 54, 47, 19, 14, 30, 25, 41, 36, 52, 49, 17, 16, 28, 27, 39, 38, 50, 51, 15, 18, 26, 29, 37, 40, 48, 53, 13, 20, 24, 31, 35, 42, 46, 65, 56, 75, 76, 85, 86, 95, 96, 106, 116, 126, 136, 146, 157, 105, 97, 64, 57, 74
Offset: 1

Views

Author

Eric Angelini and M. F. Hasler, Sep 14 2022

Keywords

Comments

Conjecture: The sequence contains all non-palindromic numbers (A029742).

Crossrefs

Cf. A029742 (non-palindromes), A002113 (palindromes), A357044 (palindromes with non-palindromic sum of neighbors).

Programs

  • PARI
    A357045_first(n, U=[9], a=1)={vector(n, k, k=U[1]; until( is_A002113(a+k) && !is_A002113(k) && !setsearch(U, k), k++); U=setunion(U,[a=k]); while(#U>1 && U[2]==U[1]+1+is_A002113(U[1]+1), U=U[^1]); a)}
    
  • Python
    from itertools import count, islice
    def ispal(n): s = str(n); return s == s[::-1]
    def agen():
        aset, k, mink = {10}, 10, 12
        while True:
            an = k; yield an; aset.add(an); k = mink
            while k in aset or ispal(k) or not ispal(an+k): k += 1
            while mink in aset: mink += 1
    print(list(islice(agen(), 60))) # Michael S. Branicky, Sep 14 2022

A243359 Number of steps it takes the terms in A029742 and their reversals to reach the value 9 when the smaller term is successively subtracted from the larger term.

Original entry on oeis.org

1, 1, 5, 3, 4, 2, 2, 4, 3, 5, 1, 1, 5, 3, 4, 2, 2, 4, 3, 5, 1, 1, 5, 3, 4, 2, 2, 4, 3, 5, 1, 1, 5, 3, 4, 2, 2, 4, 3, 5, 1, 1, 5, 3, 4, 2, 2, 4, 3, 5, 1, 1, 5, 3, 4, 2, 2, 4, 3, 5, 1, 1, 5, 3, 4, 2, 2, 4, 3, 5, 1, 1, 5, 3, 4, 2, 2, 4, 3, 5, 1
Offset: 1

Views

Author

Felix Fröhlich, Jun 03 2014

Keywords

Comments

Sequence appears to be periodic with period 10, although I don't have a proof for this property.
If the successive subtraction algorithm is applied to the terms of A002113, the resulting value is always 0 after one iteration, therefore only the values resulting from the terms of that sequence's complement A029742 are taken into account for this sequence.

Examples

			For 14: 41 - 14 = 27 --> 72 - 27 = 45 --> 54 - 45 = 9 takes three steps to reach 9, therefore a(4) = 3.
		

Extensions

Extended by Ray Chandler, Aug 27 2015

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

A136522 a(n) = 1 if n is a palindrome, otherwise 0.

Original entry on oeis.org

1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
Offset: 0

Views

Author

N. J. A. Sloane, Apr 21 2008

Keywords

Comments

a(A002113(n)) = 1; a(A029742(n)) = 0.
a(n) = A202022(n) for n <= 100, a(101) = 1, A202022(101) = 0. - Reinhard Zumkeller, Dec 10 2011

Crossrefs

Programs

  • Haskell
    a136522 n = fromEnum $ n == a004086 n  -- Reinhard Zumkeller, Apr 08 2011
    
  • Mathematica
    fQ[n_]:=Module[{id=IntegerDigits[n]}, Boole[id==Reverse[id]]]; Array[fQ, 100] (* Vladimir Joseph Stephan Orlovsky, Dec 29 2010 *)
    Table[If[PalindromeQ[n],1,0],{n,0,120}] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Aug 23 2019 *)
  • Python
    def A136522(n): return int((s:=str(n))[:(t:=(len(s)+1)//2)]==s[:-t-1:-1]) # Chai Wah Wu, Jun 23 2022

Formula

a(n) = if A004086(n) = n then 1 else 0. - Reinhard Zumkeller, Apr 08 2011
a(n) = A000007(A064834(n)). - Reinhard Zumkeller, Sep 18 2013

A031955 Numbers with exactly two distinct base-10 digits.

Original entry on oeis.org

10, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 100, 101, 110, 112, 113, 114, 115, 116, 117, 118, 119, 121, 122, 131, 133, 141, 144, 151, 155, 161, 166
Offset: 1

Views

Author

Keywords

Comments

The three-digit terms are given by A210666(1,...,244). For numbers with exactly two distinct (but unspecified) digits in other bases, see A031948-A031954. For numbers made of two *given* digits, see A007088 (digits 0 & 1), A007931 (digits 1 & 2), A032810 (digits 2 & 3), A032834 (digits 3 & 4), A256290 (digits 4 & 5), A256291 (digits 5 & 6), A256292 (digits 6 & 7), A256340 (digits 7 & 8), A256341 (digits 8 & 9), and A032804-A032816 (in other bases). - M. F. Hasler, Apr 04 2015
A235154 is a subsequence. - Altug Alkan, Dec 03 2015
A235717 is a subsequence. - Robert Israel, Dec 03 2015

Crossrefs

Programs

  • Haskell
    a031955 n = a031955_list !! (n-1)
    a031955_list = filter ((== 2) . a043537) [0..]
    -- Reinhard Zumkeller, Feb 05 2012
    
  • Maple
    M:= 5: # to get all terms < 10^M
    sort([seq(seq(seq(seq(add(10^(m-j)*`if`(member(j,S2),d2,d1),j=1..m)  ,
      S2 = combinat:-powerset({$2..m}) minus {{}}),
      d2 = {$0..9} minus {d1}), d1 = 1..9), m=2..M)]); # Robert Israel, Dec 03 2015
  • Mathematica
    Select[Range@ 166, Length@ Union@ IntegerDigits@ # == 2 &] (* Michael De Vlieger, Dec 03 2015 *)
  • PARI
    is_A031955(n)=#Set(digits(n))==2 \\ M. F. Hasler, Apr 04 2015
    
  • Python
    def ok(n): return len(set(str(n))) == 2
    print(list(filter(ok, range(167)))) # Michael S. Branicky, Oct 12 2021

Formula

A043537(a(n)) = 2. - Reinhard Zumkeller, Dec 03 2009

Extensions

Name edited by Charles R Greathouse IV, Feb 13 2017

A065206 Numbers which need one 'Reverse and Add' step to reach a palindrome.

Original entry on oeis.org

10, 12, 13, 14, 15, 16, 17, 18, 20, 21, 23, 24, 25, 26, 27, 29, 30, 31, 32, 34, 35, 36, 38, 40, 41, 42, 43, 45, 47, 50, 51, 52, 53, 54, 56, 60, 61, 62, 63, 65, 70, 71, 72, 74, 80, 81, 83, 90, 92, 100, 102, 103, 104, 105, 106, 107, 108, 110, 112, 113, 114, 115, 116, 117
Offset: 1

Views

Author

Klaus Brockhaus, Oct 21 2001

Keywords

Comments

The number of steps starts at 0, so palindromes (A002113) are excluded.
Numbers k such that A033665(k) = 1. - Andrew Howroyd, Dec 05 2024

Crossrefs

Programs

  • ARIBAS
    function revadd_steps(k,stop: integer); var c,n,m,steps,rev: integer; begin n := 0; c := 0; while c < stop do m := n; rev := int_reverse(m); steps := 0; while steps < k and m <> rev do m := m + rev; rev := int_reverse(m); inc(steps); end; if steps = k and m = rev then write(n," "); inc(c); end; inc(n); end; end; revadd_steps(1,66).
    
  • Haskell
    a065206 n = a065206_list !! (n-1)
    a065206_list = filter ((== 1) . a136522 . a056964) a029742_list
    -- Reinhard Zumkeller, Oct 14 2011
    
  • Mathematica
    Select[Range[10,120],!PalindromeQ[#]&&PalindromeQ[#+IntegerReverse[#]]&] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Jun 14 2017 *)
  • PARI
    isok(n,s=1)={for(k=0, s, my(r=fromdigits(Vecrev(digits(n)))); if(r==n, return(k==s)); n += r); 0} \\ Andrew Howroyd, Dec 05 2024

Extensions

Offset corrected by Harry J. Smith, Oct 13 2009

A064834 If n (in base 10) is d_1 d_2 ... d_k then a(n) = Sum_{i = 1..[k/2] } |d_i - d_{k-i+1}|.

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 0, 1, 2, 3
Offset: 0

Views

Author

N. J. A. Sloane, Oct 25 2001

Keywords

Comments

Might be called the Palindromic Deviation (or PD(n)) of n, since it measures how far n is from being a palindrome. - W. W. Kokko, Mar 13 2013
a(A002113(n)) = 0; a(A029742(n)) > 0; A136522(n) = A000007(a(n)). - Reinhard Zumkeller, Sep 18 2013

Examples

			a(456) = | 4 - 6 | = 2, a(4567) = | 4 - 7 | + | 5 - 6 | = 4.
		

Crossrefs

Programs

  • Haskell
    a064834 n = sum $ take (length nds `div` 2) $
                      map abs $ zipWith (-) nds $ reverse nds
       where nds = a031298_row n
    -- Reinhard Zumkeller, Sep 18 2013
    
  • Maple
    f:=proc(n)
    local t1,t2,i;
    t1:=convert(n,base,10);
    t2:=nops(t1);
    add( abs(t1[i]-t1[t2+1-i]),i=1..floor(t2/2) );
    end;
    [seq(f(n),n=0..120)]; # N. J. A. Sloane, Mar 24 2013
  • Mathematica
    f[n_] := (k = IntegerDigits[n]; l = Length[k]; Sum[ Abs[ k[[i]] - k[[l - i + 1]]], {i, 1, Floor[l/2] } ] ); Table[ f[n], {n, 0, 100} ]
  • Python
    from sympy import floor, ceiling
    def A064834(n):
        x, y = str(n), 0
        lx2 = len(x)/2
        for a,b in zip(x[:floor(lx2)],x[:ceiling(lx2)-1:-1]):
            y += abs(int(a)-int(b))
        return y
    # Chai Wah Wu, Aug 09 2014

Extensions

More terms from Vladeta Jovovic, Matthew Conroy and Robert G. Wilson v, Oct 26 2001

A062917 Nonpalindromic numbers k such that k is not divisible by 10 and k*R(k) is a square, where R(k) is the reversal of k (A004086).

Original entry on oeis.org

144, 169, 288, 441, 528, 768, 825, 867, 882, 961, 1089, 1584, 2178, 4851, 8712, 9801, 10404, 10609, 10989, 12544, 12769, 13104, 14544, 14884, 15984, 20808, 21978, 26208, 27648, 27848, 36828, 40131, 40401, 44521, 44541, 48139, 48841, 48951
Offset: 1

Views

Author

Amarnath Murthy, Jul 02 2001

Keywords

Comments

The sequence has infinitely many terms, some of which can be derived from 1089 and 2178.

Examples

			2178 is a term as 2178*8712 = 4356^2.
10891089 is a term as 10891089*98019801 = 32673267^2.
		

Crossrefs

Cf. A004086.
Subsequence of A029742.

Programs

  • Mathematica
    okQ[n_]:=Module[{idn=IntegerDigits[n],ridn},ridn=Reverse[idn];idn!= ridn && !Divisible[n,10]&&IntegerQ[Sqrt[n FromDigits[ridn]]]]; Select[Range[ 50000], okQ] (* Harvey P. Dale, Dec 08 2012 *)

Extensions

More terms from Reiner Martin, Jul 10 2001

A139819 Complement of repdigit numbers A010785.

Original entry on oeis.org

10, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 89
Offset: 1

Views

Author

N. J. A. Sloane, Jun 02 2008

Keywords

Comments

Identical to (base 10) non-palindromic numbers A029742 up to a(83) = 101 which is a term of this sequence but not in A029742. - M. F. Hasler, Sep 08 2015

Crossrefs

Cf. A066484 (subsequence).
Cf. A029742 (non-palindromic in base 10), A016038 (in any base), A050813 (in bases 2..10).

Programs

  • Haskell
    a139819 n = a139819_list !! (n-1)
    a139819_list = filter ((== 0) . a202022) [0..] -- Reinhard Zumkeller, Dec 09 2011
    
  • Maple
    isA139819 := proc(n)
        convert(n,base,10) ;
        convert(%,set) ;
        simplify(nops(%) >1 ) ;
    end proc: # R. J. Mathar, Jan 17 2017
  • PARI
    is_A139819(n)=#Set(digits(n))>1 \\ M. F. Hasler, Sep 08 2015
    
  • Python
    def A139819(n):
        m, k = n, n+9*((l:=len(str(n)))-1)+9*n//(10**l-1)
        while m != k:
            m, k = k, n+9*((l:=len(str(k)))-1)+9*k//(10**l-1)
        return m # Chai Wah Wu, Sep 04 2024

Formula

A202022(a(n)) = 0. - Reinhard Zumkeller, Dec 09 2011
Showing 1-10 of 33 results. Next