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-4 of 4 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

A213879 Positive palindromes that are not the sum of two positive palindromes.

Original entry on oeis.org

1, 111, 131, 141, 151, 161, 171, 181, 191, 1331, 1441, 1551, 1661, 1771, 1881, 1991, 10301, 10401, 10501, 10601, 10701, 10801, 10901, 11111, 11211, 11311, 11411, 11511, 11611, 11711, 11811, 11911, 12021, 12121, 12321, 12421, 12521, 12621, 12721, 12821
Offset: 1

Views

Author

Arkadiusz Wesolowski, Jun 23 2012

Keywords

Comments

These numbers do not occur in A035137.

Examples

			22 is not a member because 22 = 11 + 11.
		

Crossrefs

Programs

  • Maple
    # From N. J. A. Sloane, Sep 09 2015: bP is a list of the palindromes
    a:={}; M:=400; for n from 3 to M do p:=bP[n];
    # is p a sum of two palindromes?
    sw:=-1; for i from 2 to n-1 do j:=p-bP[i]; if digrev(j)=j then sw:=1; break; fi;
    od;
    if sw<0 then a:={op(a),p}; fi; od:
    b:=sort(convert(a,list));
  • Mathematica
    lst1 = {}; lst2 = {}; r = 12821; Do[If[FromDigits@Reverse@IntegerDigits[n] == n, AppendTo[lst1, n]], {n, r}]; l = Length[lst1]; Do[s = lst1[[i]] + lst1[[j]]; AppendTo[lst2, s], {i, l - 1}, {j, i}]; Complement[lst1, lst2]
    palQ[n_] := Reverse[x = IntegerDigits[n]] == x; t1 = Select[Range[12900], palQ[#] &]; Complement[t1, Union[Flatten[Table[i + j, {i, t1}, {j, t1}]]]] (* Jayanta Basu, Jun 15 2013 *)

Formula

({ A002113 } intersect { A319477 }) minus { 0 }. - Alois P. Heinz, Sep 19 2018

A319468 Number of partitions of n into exactly two nonzero decimal palindromes.

Original entry on oeis.org

0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 4, 5, 4, 4, 3, 3, 2, 2, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 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
Offset: 0

Views

Author

Alois P. Heinz, Sep 19 2018

Keywords

Crossrefs

Column k=2 of A319453.

Programs

  • Maple
    p:= proc(n) option remember; local i, s; s:= ""||n;
          for i to iquo(length(s), 2) do if
            s[i]<>s[-i] then return false fi od; true
        end:
    h:= proc(n) option remember; `if`(n<1, 0,
         `if`(p(n), n, h(n-1)))
        end:
    b:= proc(n, i, t) option remember; `if`(n=0, 1, `if`(t*i (k-> b(n, h(n), k)-b(n, h(n), k-1))(2):
    seq(a(n), n=0..100);

Formula

a(n) = [x^n y^2] 1/Product_{j>=2} (1-y*x^A002113(j)).
a(n) = 0 <=> n in { A319477 }.

A319586 Number of n-digit base-10 palindromes (A002113) that cannot be written as the sum of two positive base-10 palindromes.

Original entry on oeis.org

2, 0, 8, 7, 95, 94, 975, 971, 9810, 9805, 98288, 98272
Offset: 1

Views

Author

Hugo Pfoertner, Sep 23 2018

Keywords

Examples

			a(1) = 2, because 0 and 1 are not sums of two positive 1-digit integers, all of which are palindromes. a(3) = 8, because the 8 3-digit palindromes 111, 131, 141, 151, 161, 171, 181, and 191 (A213879(2) ... A213879(9)) cannot be written as sum of two nonzero palindromes.
		

Crossrefs

Programs

  • PARI
    \\ calculates a(2)...a(8) using M. F. Hasler's functions in A002113
    A002113(n)={my(L=logint(n,10));(n-=L=10^max(L-(n<11*10^(L-1)), 0))*L+fromdigits(Vecrev(digits(if(nA002113(n)={Vecrev(n=digits(n))==n}
    inv_A002113(P)={P\(P=10^(logint(P+!P, 10)\/2))+P}
    for(i=1,8,j=0;for(m=inv_A002113(10^i+1),inv_A002113(2*(10^i+1)),P=A002113(m);issum=0;for(k=2,m,PP=A002113(k);if(PP>P/2,break);if(is_A002113(P-PP),issum=1;break));if(issum==0,j++));print1(j,", ",))
    
  • Python
    from sympy import isprime
    from itertools import product
    def pals(d, base=10): # all d-digit palindromes
        digits = "".join(str(i) for i in range(base))
        for p in product(digits, repeat=d//2):
            if d > 1 and p[0] == "0": continue
            left = "".join(p); right = left[::-1]
            for mid in [[""], digits][d%2]: yield int(left + mid + right)
    def a(n):
        palslst = [p for d in range(1, n+1) for p in pals(d)][1:]
        palsset = set(palslst)
        cs = ctot = 0
        for p in pals(n):
            ctot += 1
            for p1 in palslst:
                if p - p1 in palsset: cs += 1; break
                if p1 > p//2: break
        return ctot - cs
    print([a(n) for n in range(1, 8)]) # Michael S. Branicky, Jul 12 2021

Extensions

a(12) from Giovanni Resta, Oct 01 2018
Showing 1-4 of 4 results.