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-8 of 8 results.

A035137 Numbers that are not the sum of 2 palindromes (where 0 is considered a palindrome).

Original entry on oeis.org

21, 32, 43, 54, 65, 76, 87, 98, 201, 1031, 1041, 1042, 1051, 1052, 1053, 1061, 1062, 1063, 1064, 1071, 1072, 1073, 1074, 1075, 1081, 1082, 1083, 1084, 1085, 1086, 1091, 1092, 1093, 1094, 1095, 1096, 1097, 1099, 1101, 1103, 1104, 1105, 1106, 1107, 1108
Offset: 1

Views

Author

Patrick De Geest, Nov 15 1998

Keywords

Comments

Apparently, every positive number is equal to the sum of at most 3 positive palindromes. - Giovanni Resta, May 12 2013
A260254(a(n)) = 0. - Reinhard Zumkeller, Jul 21 2015
A261675(a(n)) >= 3 (and, conjecturally, = 3). - N. J. A. Sloane, Sep 03 2015
This sequence is infinite. Proof: It is easy to see that 200...01 (with any number of zeros) cannot be the sum of two palindromes. - N. J. A. Sloane, Sep 03 2015
The conjecture that every number is the sum of 3 palindromes fails iff there is a term a(n) such that for all palindromes P < a(n), the difference a(n) - P is also a term of this sequence. - M. F. Hasler, Sep 08 2015
Cilleruelo and Luca (see links) have proved the conjecture that every positive integer is the sum of at most three palindromes (in bases >= 5), and also that the density of those that require three is positive. - Christopher E. Thompson, Apr 14 2016

Crossrefs

Cf. A260254, A260255 (complement), A002113, A261906, A261907.
Cf. A319477 (disallowing zero).

Programs

  • Haskell
    a035137 n = a035137_list !! (n-1)
    a035137_list = filter ((== 0) . a260254) [0..]
    -- Reinhard Zumkeller, Jul 21 2015
    
  • Maple
    N:= 4: # to get all terms with <= N digits
    revdigs:= proc(n) local L,j,nL;
      L:= convert(n,base,10); nL:= nops(L);
      add(L[j]*10^(nL-j),j=1..nL);
    end proc;
    palis:= $0..9:
    for d from 2 to N do
      if d::even then
        palis:= palis, seq(x*10^(d/2)+revdigs(x),x=10^(d/2-1)..10^(d/2)-1)
      else
        palis:= palis, seq(seq(x*10^((d+1)/2)+y*10^((d-1)/2)+revdigs(x),y=0..9),x=10^((d-3)/2)..10^((d-1)/2)-1);
      fi
    od:
    palis:= [palis]:
    A:= Array(0..10^N-1):
    A[palis]:= 1:
    B:= SignalProcessing:-Convolution(A,A):
    select(t -> B[t+1] < 0.5, [$1..10^N-1]); # Robert Israel, Jun 22 2015
  • Mathematica
    palQ[n_]:=FromDigits[Reverse[IntegerDigits[n]]]==n; nn=1108; t={}; Do[i=c=0; While[i<=n && c!=1,If[palQ[i] && palQ[n-i], AppendTo[t,n]; c=1]; i++],{n,nn}]; Complement[Range[nn],t] (* Jayanta Basu, May 12 2013 *)
  • PARI
    is_A035137(n)={my(k=0);!until(n<2*k=nxt(k),is_A002113(n-k)&&return)} \\ Uses function nxt() given in A002113. Not very efficient for large n, better start with k=n-A261423(n). Maybe also better use A261423 rather than nxt(). - M. F. Hasler, Jul 21 2015

A260255 Numbers that can be written as the sum of two nonnegative palindromes in base 10.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120
Offset: 1

Views

Author

Reinhard Zumkeller, Jul 21 2015

Keywords

Comments

More than the usual number of terms are shown in order to distinguish this from A261906. - N. J. A. Sloane, Sep 09 2015
A260254(a(n)) > 0.

Crossrefs

Cf. A035137 (complement), A260254, A002113.
111 is a member of this sequence but not of A261906. A213879 lists the differences.

Programs

  • Haskell
    a260255 n = a260255_list !! (n-1)
    a260255_list = filter ((> 0) . a260254) [0..]
  • Mathematica
    palQ[n_Integer, base_Integer] := Block[{}, Reverse[idn = IntegerDigits[n, base]] == idn]; Take[ Union[ Plus @@@ Tuples[ Select[ Range[0, 100], palQ[#, 10] &], 2]], 90] (* Robert G. Wilson v, Jul 22 2015 *)

A261907 Numbers that are the sum of two nonzero palindromes but are not palindromes themselves.

Original entry on oeis.org

10, 12, 13, 14, 15, 16, 17, 18, 19, 20, 23, 24, 25, 26, 27, 28, 29, 30, 31, 34, 35, 36, 37, 38, 39, 40, 41, 42, 45, 46, 47, 48, 49, 50, 51, 52, 53, 56, 57, 58, 59, 60, 61, 62, 63, 64, 67, 68, 69, 70, 71, 72, 73, 74, 75, 78, 79, 80, 81, 82, 83, 84, 85, 86, 89, 90, 91, 92, 93, 94, 95, 96, 97, 100, 102, 103, 104, 105, 106, 107, 108, 109, 110, 112
Offset: 1

Views

Author

N. J. A. Sloane, Sep 09 2015

Keywords

Crossrefs

Equals A261906 \ A002113. Cf. A213879, A260255.

Programs

  • Maple
    # bP has a list of all palindromes (from A002113):
    a3:={}; M:=60; M2:=bP[M];
    for i from 2 to M do
    for j from i to M do
    k:=bP[i]+bP[j];
    if k <= M2 and digrev(k) <> k then a3:={op(a3),k}; fi;
    od: od:
    b3:=sort(convert(a3,list));

A318535 Integers a(n) such that [a(n) - k] is a palindrome in base 10, with k <10.

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 88, 89
Offset: 1

Views

Author

Eric Angelini and Jean-Marc Falcoz, Aug 28 2018

Keywords

Comments

This is not the sequence A260255 although more than the first 111 terms are equal.

Examples

			21 is not in the sequence because 11 (the closest palindromic integer < 21) is not reachable by subtracting an integer < 10 from 21. The integers 32, 43 or 2018 are not in the sequence for the same reason.
		

Crossrefs

Cf. A318536 for an equivalent sequence [addition of (k < 10) instead of subtraction].
Cf. A261906.

A356824 Palindromes that can be written as the sum of two palindromic primes.

Original entry on oeis.org

4, 5, 6, 7, 8, 9, 22, 202, 232, 252, 262, 282, 292, 414, 444, 454, 464, 474, 484, 494, 626, 666, 686, 696, 808, 828, 858, 878, 888, 898, 20002, 20602, 20802, 20902, 21612, 21712, 21812, 21912, 22622, 22722, 22822, 22922, 23632, 23732, 23832, 23932, 24642, 24742, 24842, 24942
Offset: 1

Views

Author

Tanya Khovanova, Aug 29 2022

Keywords

Comments

With the exception of 22, which is the sum of 11 and 11, no term of this sequence has an even number of digits. Proof: Other than 11, palindromes with an even number of digits are not primes (since they are divisible by 11). Suppose m is a term of this sequence with 2k digits. Then m must be the sum of two palindromic primes p and q with 2k-1 digits each. It follows that the first and the last digit of m is 1. Hence, either p or q is even, creating a contradiction with primality.
With the exception of 5, 7, and 9, all terms of this sequence are even. Proof: two consecutive multi-digit palindromes differ by at least 10, so larger palindromes can't be the sum of a palindromic prime and 2. Thus, each multi-digit term is the sum of two odd numbers.

Examples

			282 can be written as the sum of two prime palindromes, 101 and 181. Thus, 282 is in the sequence.
		

Crossrefs

Programs

  • Mathematica
    q := Select[Range[30000], PalindromeQ[#] && PrimeQ[#] &]
    Select[Union[Flatten[Table[q[[n]] + q[[m]], {n, Length[q]}, {m, Length[q]}]]],
    PalindromeQ[#] &]
  • Python
    from sympy import isprime
    from itertools import product
    def ispal(n): s = str(n); return s == s[::-1]
    def oddpals(d): # generator of odd palindromes with d digits
        if d == 1: yield from [1, 3, 5, 7, 9]; return
        for first in "13579":
            for p in product("0123456789", repeat=(d-2)//2):
                left = "".join(p); right = left[::-1]
                for mid in [[""], "0123456789"][d%2]:
                    yield int(first + left + mid + right + first)
    def auptod(dd):
        N, alst, pp = 10**dd, [], [2, 3, 5, 7, 11]
        pp += [p for d in range(3, dd+1, 2) for p in oddpals(d) if isprime(p)]
        return sorted(set(p+q for p in pp for q in pp if p+qMichael S. Branicky, Aug 29 2022

A287961 Numbers that are the sum of two palindromic primes (A002385).

Original entry on oeis.org

4, 5, 6, 7, 8, 9, 10, 12, 13, 14, 16, 18, 22, 103, 104, 106, 108, 112, 133, 134, 136, 138, 142, 153, 154, 156, 158, 162, 183, 184, 186, 188, 192, 193, 194, 196, 198, 202, 232, 252, 262, 282, 292, 302, 312, 315, 316, 318, 320, 322, 324, 332, 342, 355, 356, 358, 360, 362, 364, 372, 375, 376, 378, 380
Offset: 1

Views

Author

Ilya Gutkovskiy, Jun 03 2017

Keywords

Crossrefs

Programs

  • Mathematica
    nmax = 380; f[x_] := Sum[Boole[PalindromeQ[k] && PrimeQ[k]] x^k, {k, 1, nmax}]^2; Exponent[#, x] & /@ List @@ Normal[Series[f[x], {x, 0, nmax}]]

A262173 Number of nonnegative integers < 10^n that are palindromes or the sum of 2 palindromes.

Original entry on oeis.org

1, 10, 92, 991, 8012, 90970, 733052, 8861377, 68729295, 875790193
Offset: 0

Views

Author

Chai Wah Wu, Sep 18 2015

Keywords

Crossrefs

A309325 Numbers that are the sum of two successive palindromes.

Original entry on oeis.org

1, 3, 5, 7, 9, 11, 13, 15, 17, 20, 33, 55, 77, 99, 121, 143, 165, 187, 200, 212, 232, 252, 272, 292, 312, 332, 352, 372, 393, 414, 434, 454, 474, 494, 514, 534, 554, 574, 595, 616, 636, 656, 676, 696, 716, 736, 756, 776, 797, 818, 838, 858, 878, 898, 918, 938, 958, 978
Offset: 1

Views

Author

Ilya Gutkovskiy, Jul 23 2019

Keywords

Crossrefs

Programs

  • Mathematica
    Total /@ Partition[Select[Range[0, 500], PalindromeQ], 2, 1]
  • Python
    from itertools import chain, count, islice
    def A309325_gen(): # generator of terms
        c = 0
        for a in chain.from_iterable(chain((int((s:=str(d))+s[-2::-1]) for d in range(10**l,10**(l+1))), (int((s:=str(d))+s[::-1]) for d in range(10**l,10**(l+1)))) for l in count(0)):
            yield c+(c:=a)
    A309325_list = list(islice(A309325_gen(),20)) # Chai Wah Wu, Jun 23 2022

Formula

a(n) = A002113(n) + A002113(n+1).
Showing 1-8 of 8 results.