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.

Previous Showing 101-110 of 829 results. Next

A351717 Numbers whose maximal (or lazy) Lucas representation (A130311) is palindromic.

Original entry on oeis.org

0, 2, 3, 5, 6, 10, 12, 14, 17, 20, 28, 30, 34, 36, 42, 46, 56, 61, 75, 77, 85, 92, 94, 101, 107, 115, 122, 128, 150, 166, 176, 198, 200, 211, 219, 233, 244, 246, 260, 271, 277, 288, 296, 310, 321, 345, 360, 396, 405, 441, 469, 484, 520, 522, 544, 562, 570, 588
Offset: 1

Views

Author

Amiram Eldar, Feb 17 2022

Keywords

Comments

A001610(n) = Lucas(n+1) - 1 is a term for all n, since A001610(0) = 0 has the representation 0 and the representation of Lucas(n+1) - 1 is n 1's for n > 0.

Examples

			The first 10 terms are:
   n  a(n)  A130311(a(n))
   ----------------------
   1   0               0
   2   2               1
   3   3              11
   4   5             101
   5   6             111
   6  10            1111
   7  12           10101
   8  14           11011
   9  17           11111
  10  20          101101
		

Crossrefs

Programs

  • Mathematica
    lazy = Select[IntegerDigits[Range[6000], 2], SequenceCount[#, {0, 0}] == 0 &]; t = Total[# * Reverse @ LucasL[Range[0, Length[#] - 1]]] & /@ lazy; s = FromDigits /@ lazy[[TakeWhile[Flatten[FirstPosition[t, #] & /@ Range[Max[t]]], NumberQ]]]; Join[{0}, Position[s, _?PalindromeQ] // Flatten]

A046447 Apart from initial term, composite numbers with the property that the concatenation of their prime factors is a palindrome.

Original entry on oeis.org

1, 4, 8, 9, 16, 25, 27, 32, 39, 49, 64, 69, 81, 119, 121, 125, 128, 129, 159, 219, 243, 249, 256, 259, 329, 339, 343, 403, 429, 469, 507, 512, 625, 669, 679, 729, 795, 1024, 1207, 1309, 1329, 1331, 1533, 1547, 1587, 1589, 1703, 2023, 2048, 2097, 2187, 2319
Offset: 1

Views

Author

Patrick De Geest, Jul 15 1998

Keywords

Comments

Prime factors considered with multiplicity. - Harvey P. Dale, Apr 20 2025

Examples

			81 is a term because 81 = 3 * 3 * 3 * 3 -> 3333 is palindromic.
		

Crossrefs

Programs

  • Haskell
    a046447 n = a046447_list !! (n-1)
    a046447_list = 1 : filter f [1..] where
       f x = length ps > 1 && ps' == reverse ps'
             where ps' = concatMap show ps; ps = a027746_row x
    -- Reinhard Zumkeller, May 02 2014
    
  • Mathematica
    concat[n_]:=Flatten[Table[IntegerDigits[First[n]],{Last[n]}]]; palQ[n_]:= Module[{x=Flatten[concat/@FactorInteger[n]]},x==Reverse[x]&&!PrimeQ[n]]; Select[Range[2500],palQ] (* Harvey P. Dale, May 24 2011 *)
    cpfpQ[n_]:=PalindromeQ[FromDigits[Flatten[IntegerDigits/@Flatten[PadRight[{},#[[2]],#[[1]]]&/@FactorInteger[n]]]]]; Join[{1},Select[Range[2500],CompositeQ[ #]&&cpfpQ[#]&]] (* Harvey P. Dale, Apr 20 2025 *)
  • Python
    from sympy import factorint, isprime
    A046447_list = [1]
    for n in range(4, 10**6):
        if not isprime(n):
            s = ''.join([str(p)*e for p, e in sorted(factorint(n).items())])
            if s == s[::-1]:
                A046447_list.append(n) # Chai Wah Wu, Jan 03 2015

Extensions

Definition slightly modified by Harvey P. Dale, Apr 20 2025

A083852 Decimal palindromes that are multiples of 11.

Original entry on oeis.org

0, 11, 22, 33, 44, 55, 66, 77, 88, 99, 121, 242, 363, 484, 616, 737, 858, 979, 1001, 1111, 1221, 1331, 1441, 1551, 1661, 1771, 1881, 1991, 2002, 2112, 2222, 2332, 2442, 2552, 2662, 2772, 2882, 2992, 3003, 3113, 3223, 3333, 3443, 3553, 3663, 3773, 3883, 3993, 4004
Offset: 1

Views

Author

Reinhard Zumkeller, May 06 2003

Keywords

Comments

A083850(a(n))>0; palindromes with even length are terms.

Crossrefs

Programs

  • Mathematica
    Select[Range[0, 5500, 11], PalindromeQ] (* Paolo Xausa, Jul 07 2025 *)
  • PARI
    forstep(k=0, 10^5, 11, d=digits(k); d==Vecrev(d) && print1(k, ", ")) \\ Jeppe Stig Nielsen, May 08 2020

A228730 Lexicographically earliest sequence of distinct nonnegative integers such that the sum of two consecutive terms is a palindrome in base 10.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 16, 17, 27, 28, 38, 39, 49, 50, 51, 15, 7, 26, 18, 37, 29, 48, 40, 59, 42, 13, 9, 24, 20, 35, 31, 46, 53, 58, 8, 14, 19, 25, 30, 36, 41, 47, 52, 69, 32, 12, 10, 23, 21, 34, 43, 45, 54, 57, 44, 11, 22, 33, 55, 56, 65, 66, 75, 76, 85, 86, 95, 96
Offset: 0

Views

Author

Paul Tek, Aug 31 2013

Keywords

Comments

From M. F. Hasler, Nov 09 2013: (Start)
At each step, choose the smallest number not occurring earlier and such that a(n+1)+a(n) are palindromes, for all n.
Conjectured to be a permutation of the nonnegative integers.
See A062932 where injectivity is replaced by monotonicity; the sequences differ from a(16)=15 on.
This is an "arithmetic" analog to sequences A228407 and A228410, where instead of the sum, the union of the digits of subsequent terms is considered. (End)

Examples

			a(1) + a(2) = 3.
a(2) + a(3) = 5.
a(3) + a(4) = 7.
a(4) + a(5) = 9.
a(5) + a(6) = 11.
a(6) + a(7) = 22.
a(7) + a(8) = 33.
		

Crossrefs

Cf. A062932 (strictly increasing variant).

Programs

  • PARI
    {a=0;u=0; for(n=1, 99, u+=1<A002113(a+k)&&(a=k)&&next(2)))} \\ M. F. Hasler, Nov 09 2013
    
  • Perl
    See Link section.
    
  • Python
    from itertools import islice
    def ispal(n): s = str(n); return s == s[::-1]
    def agen(): # generator of terms
        aset, an, mink = {0}, 0, 1
        yield 0
        while True:
            k = mink
            while k in aset or not ispal(an + k): k += 1
            an = k; aset.add(an); yield an
            while mink in aset: mink += 1
    print(list(islice(agen(), 70))) # Michael S. Branicky, Nov 07 2022

Extensions

a(0)=0 added by M. F. Hasler, Nov 15 2013

A260254 Number of ways to write n as sum of two palindromes in decimal representation.

Original entry on oeis.org

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

Views

Author

Reinhard Zumkeller, Jul 21 2015

Keywords

Comments

a(A035137(n)) = 0; a(A260255(n)) > 0.

Examples

			.   n | a(n) |                                n | a(n) |
. ----+------+--------------------------    ----+------+--------------
.   0 |    1 |  0                            21 |    0 |  ./.
.   1 |    1 |  1                            22 |    2 |  22, 11+11
.   2 |    2 |  2, 1+1                       23 |    1 |  22+1
.   3 |    2 |  3, 2+1                       24 |    1 |  22+2
.   4 |    3 |  4, 3+1, 2+2                  25 |    1 |  22+3
.   5 |    3 |  5, 4+1, 3+2                  26 |    1 |  22+4
.   6 |    4 |  6, 5+1, 4+2, 3+3             27 |    1 |  22+5
.   7 |    4 |  7, 6+1, 5+2, 4+3             28 |    1 |  22+6
.   8 |    5 |  8, 7+1, 6+2, 5+3, 4+4        29 |    1 |  22+7
.   9 |    5 |  9, 8+1, 7+2, 6+3, 5+4        30 |    1 |  22+8
.  10 |    5 |  9+1, 8+2, 7+3, 6+4, 5+5      31 |    1 |  22+9
.  11 |    5 |  11, 9+2, 8+3, 7+4, 6+5       32 |    0 |  ./.
.  12 |    5 |  11+1, 9+3, 8+4, 7+5, 6+6     33 |    2 |  33, 22+11
.  13 |    4 |  11+2, 9+4, 8+5, 7+6          34 |    1 |  33+1
.  14 |    4 |  11+3, 9+5, 8+6, 7+7          35 |    1 |  33+2
.  15 |    3 |  11+4, 9+6, 8+7               36 |    1 |  33+3
.  16 |    3 |  11+5, 9+7, 8+8               37 |    1 |  33+4
.  17 |    2 |  11+6, 9+8                    38 |    1 |  33+5
.  18 |    2 |  11+7, 9+9                    39 |    1 |  33+6
.  19 |    1 |  11+8                         40 |    1 |  33+7
.  20 |    1 |  11+9                         41 |    1 |  33+8  .
		

Crossrefs

Programs

  • Haskell
    a260254 n = sum $ map (a136522 . (n -)) $
                   takeWhile (<= n `div` 2) a002113_list

Formula

a(n) = sum{A136522(n - A002113(k)): k = 1..floor(n/2)}.

A261675 Minimal number of palindromes in base 10 that add to n.

Original entry on oeis.org

1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 2, 1, 2, 2, 2, 2
Offset: 0

Views

Author

N. J. A. Sloane, Sep 02 2015

Keywords

Comments

This sequence coincides with A088601 for n <= 301, but differs at n=302.
Although A088601 and this sequence agree for a large number of terms, because of their importance they warrant separate entries.
Cilleruelo and Luca prove that a(n) <= 3 (in fact they prove this for any fixed base g>=5). - Danny Rorabaugh, Feb 26 2016

Crossrefs

Programs

  • PARI
    ispal(n)=my(d=digits(n)); d==Vecrev(d);
    a(n)=my(L=n\2,d,e); if(ispal(n), return(1)); d=[1]; while((e=fromdigits(d))<=L, if(ispal(n-e), return(2)); my(k=#d,i=(k+1)\2); while(i&&d[i]==9, d[i]=0; d[k+1-i]=0; i--); if(i, d[i]++; d[k+1-i]=d[i], d=vector(#d+1); d[1]=d[#d]=1)); 3; \\ Charles R Greathouse IV, Nov 12 2018

A332121 a(n) = 2*(10^(2n+1)-1)/9 - 10^n.

Original entry on oeis.org

1, 212, 22122, 2221222, 222212222, 22222122222, 2222221222222, 222222212222222, 22222222122222222, 2222222221222222222, 222222222212222222222, 22222222222122222222222, 2222222222221222222222222, 222222222222212222222222222, 22222222222222122222222222222, 2222222222222221222222222222222
Offset: 0

Views

Author

M. F. Hasler, Feb 09 2020

Keywords

Crossrefs

Cf. A002275 (repunits R_n = (10^n-1)/9), A002276 (2*R_n), A011557 (10^n).
Cf. A138148 (cyclops numbers with binary digits), A002113 (palindromes).
Cf. A332120 .. A332129 (variants with different middle digit 0, ..., 9).
Cf. A332131 .. A332191 (variants with different repeated digit 3, ..., 9).

Programs

  • Maple
    A332121 := n -> 2*(10^(2*n+1)-1)/9-10^n;
  • Mathematica
    Array[2 (10^(2 # + 1)-1)/9 - 10^# &, 15, 0]
  • PARI
    apply( {A332121(n)=10^(n*2+1)\9*2-10^n}, [0..15])
    
  • Python
    def A332121(n): return 10**(n*2+1)//9*2-10**n

Formula

a(n) = 2*A138148(n) + 1*10^n = A002276(2n+1) - 10^n.
G.f.: (1 + 101*x - 300*x^2)/((1 - x)(1 - 10*x)(1 - 100*x)).
a(n) = 111*a(n-1) - 1110*a(n-2) + 1000*a(n-3) for n > 2.

A043040 Numbers that are palindromic and divisible by 5.

Original entry on oeis.org

0, 5, 55, 505, 515, 525, 535, 545, 555, 565, 575, 585, 595, 5005, 5115, 5225, 5335, 5445, 5555, 5665, 5775, 5885, 5995, 50005, 50105, 50205, 50305, 50405, 50505, 50605, 50705, 50805, 50905, 51015, 51115, 51215, 51315, 51415, 51515, 51615, 51715, 51815, 51915
Offset: 1

Views

Author

Keywords

Comments

Or, 0 and numbers that are palindromic and begin with 5.

Crossrefs

Programs

  • Mathematica
    palQ[n_Integer, base_Integer] := Module[{idn = IntegerDigits[n, base]}, idn == Reverse[idn]];
    Join[{0},Select[Range[5,100000,5], IntegerDigits[#][[1]] == 5 && palQ[#, 10] &]] (* T. D. Noe, Mar 12 2013 *)
    Select[5*Range[0,11000],IntegerDigits[#]==Reverse[IntegerDigits[#]]&] (* Harvey P. Dale, Nov 29 2015 *)

Extensions

Edited to include a(1) = 0 by Paolo Xausa, Jul 07 2025

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

A241173 Start with n; add to it any of its digits; repeat; a(n) = minimal number of steps needed to reach a palindrome.

Original entry on oeis.org

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

Views

Author

N. J. A. Sloane, Apr 23 2014

Keywords

Comments

a(n) = 0 iff n is already a palindrome (A002113).
Is it a theorem that a(n) always exists?
a(n) always exists. Proof: A palindrome can be reached by simply adding the initial digit until a palindrome with the same number of digits as the initial number is reached: If no palindrome is reached by then, this will yield a number with initial digit '1'. Thereafter, this procedure will yield the next larger palindrome - either not larger than 19...91 or, after 19...9 + 1 = 20...0, at 20...02. - M. F. Hasler, Apr 26 2014

Examples

			Examples for a(10) through a(23):
a(10) = 1 via 10 -> 11
a(11) = 0 via 11
a(12) = 3 via 12 -> 13 -> 16 -> 22
a(13) = 2 via 13 -> 16 -> 22
a(14) = 3 via 14 -> 15 -> 16 -> 22
a(15) = 2 via 15 -> 16 -> 22
a(16) = 1 via 16 -> 22
a(17) = 4 via 17 -> 18 -> 19 -> 20 -> 22
a(18) = 3 via 18 -> 19 -> 20 -> 22
a(19) = 2 via 19 -> 20 -> 22
a(20) = 1 via 20 -> 22
a(21) = 1 via 21 -> 22
a(22) = 0 via 22
a(23) = 3 via 23 -> 25 -> 30 -> 33
		

References

  • Eric Angelini, Posting to Sequence Fans Mailing List, Apr 20 2014

Crossrefs

Cf. A002113.
A241174 gives the smallest number that takes n steps to reach a palindrome.

Programs

  • Mathematica
    A241173[n_] := Module[{c, nx},
       If[n == IntegerReverse[n], Return[0]];
       c = 1; nx = n;
       While[ ! AnyTrue[nx = Flatten[nx + IntegerDigits[nx]], # == IntegerReverse[#] &], c++];
       Return[c]];
    Table[A241173[i], {i, 0, 100}] (* Robert Price, Mar 17 2019 *)
  • PARI
    a(n,m=0)={ if( m, my(d); for(i=1,#d=vecsort(digits(n),,12), d[i] && if( m>1, a(n+d[i],m-1) /*&& !print1("/*",[n,d[i],m],"* /")*/, is_A002113(n+d[i])) && return(m)), is_A002113(n) || until(a(n,m++),); m)} \\ Memoization should be implemented to improve performance which remains poor esp. for terms just above 10^k+1. - M. F. Hasler, Apr 26 2014
    
  • PARI
    \\ See Corneth link; faster than above. David A. Corneth, Mar 21 2019

Extensions

More terms from M. F. Hasler, Apr 26 2014
Previous Showing 101-110 of 829 results. Next