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 11-20 of 829 results. Next

A357044 Lexicographic earliest sequence of distinct palindromes (A002113) such that a(n)+a(n+1) is never palindromic.

Original entry on oeis.org

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

Views

Author

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

Keywords

Comments

Obviously the sequence cannot contain 0.
It is easy to prove that the sequence is a permutation of the nonzero palindromes (in the sense that it contains each of them exactly once).

Crossrefs

Cf. A002113 (palindromes), A029742 (non-palindromes), A262038 (next palindrome), A357045 (non-palindromes with palindromic sum of neighbors).

Programs

  • PARI
    A357044_first(n, U=[0], a=9)={vector(n,k, k=U[1]; while(is_A002113(a+k=A262038(k+1)) || setsearch(U, k), ); U=setunion(U,[a=k]); while(#U>1 && U[2]==A262038(U[1]+1), U=U[^1]); a)}
    
  • Python
    from itertools import count, islice
    def ispal(n): s = str(n); return s == s[::-1]
    def nextpal(p): # next largest palindrome after palindrome p
        d = str(p)
        if set(d) == {'9'}: return int('1' + '0'*(len(d)-1) + '1')
        h = str(int(d[:(len(d)+1)//2]) + 1)
        return int(h + h[:-1][::-1]) if len(d)&1 else int(h + h[::-1])
    def agen():
        aset, pal, minpal = {1}, 1, 2
        while True:
            an = pal; yield an; aset.add(an); pal = minpal
            while pal in aset or ispal(an+pal): pal = nextpal(pal)
            while minpal in aset: minpal = nextpal(minpal)
    print(list(islice(agen(), 55))) # Michael S. Branicky, Sep 14 2022

A226487 First available increasing palindromes (A002113) found in the decimal expansion of the number e-2 (A001113).

Original entry on oeis.org

7, 8, 818, 2662, 9669, 39193, 94349, 99699, 985589, 988890, 5065605, 6609066, 7193917, 7390937, 8316138, 43488434, 563303365, 799929997, 1149559411, 68088588086, 85367376358, 208532235802, 991964469199
Offset: 1

Views

Author

Keywords

Comments

The entry 988890 is actually 0988890.

Crossrefs

Programs

  • Mathematica
    e = RealDigits[E-2, 10, 2500000][[1]]; palQ[n_] := n == Reverse[n]; mx = 0; k = 1;   While[k < 1000000, j = 1; While[j <= k, If[ palQ[ Take[ e, {j, k}]], p = FromDigits[ Take[e, {j, k}]]; If[p > mx, mx = p; Print[p]; e = Drop[e, k]; k = 0; Break[]]]; j++]; k++]

A235922 Minimal k > 1 such that the base-k representation of the n-th palindrome in A002113, read in decimal, is also palindrome.

Original entry on oeis.org

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

Views

Author

Vladimir Shevelev, Jan 17 2014

Keywords

Comments

We conjecture that limit of average (a(1)+...+a(n))/n exists and equals 10.

Crossrefs

A246008 Let pal(k) denote the k-th palindrome, A002113(k), and let a(0)=0 and a(1)=1. For n >= 2, if a(n-1) = pal(k), then a(n) = pal(k+i), where i = a(n-1)-a(n-2).

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 33, 252, 15451, 54533545, 445335474533544, 34533547453354645335474533543, 245335474533546453354745335454533547453354645335474533542, 14533547453354645335474533545453354745335464533547453354445335474533546453354745335454533547453354645335474533541
Offset: 0

Views

Author

Robert G. Wilson v, Sep 20 2014

Keywords

Comments

If instead we set a(n) = pal(a(n-1)), the sequence would have to start at the twelfth palindrome 22, and go from there: 12, 22, 121, 2112, 1112111, 112111111211, 1211111121111211111121, 211111121111211111121121111112111121111112, ..., . This sequence is interesting in that only the digits 1 and 2 appear so far (tested out to seventeen terms).

Examples

			For n=11, we have a(10)=11=pal(11), a(10)-a(9)=11-9=2, so a(11) = pal(11+2) = pal(13) = 33.
a(12) = 252 because it is the twenty-second palindrome after 13, the difference between 11 and 33.
		

Crossrefs

Programs

  • Mathematica
    NextPalindrome[n_] := Block[{l = Floor[ Log[ 10, n] + 1], idn = IntegerDigits[ n]}, If[ Union[ idn] == {9}, Return[n + 2], If[l < 2, Return[n + 1], If[ FromDigits[ Reverse[ Take[ idn, Ceiling[l/2]]]] > FromDigits[ Take[ idn, -Ceiling[l/2]]], FromDigits[ Join[ Take[ idn, Ceiling[l/2]], Reverse[ Take[ idn, Floor[l/2]]]]], idfhn = FromDigits[ Take[ idn, Ceiling[l/2]]] + 1; idp = FromDigits[ Join[ IntegerDigits[ idfhn], Drop[ Reverse[ IntegerDigits[ idfhn]], Mod[l, 2]]]]]]]]; f[s_List] := Block[{a = s[[-1]], b = s[[-2]]}, Append[s, Nest[ NextPalindrome@# &, a, a - b]]]; s = {0, 1}, Nest[f, s, 14]
    nthPalindrome[n_] := Block[{q = n + 1 - 10^Floor[ Log10[n + 1 - 10^Floor[ Log10[ n/10]] ]], c = Sum[ Floor[ Floor[ n/(11*10^(k - 1) - 1)]/(Floor[ n/(11*10^(k - 1) - 1)] - 1/10)] - Floor[ Floor[ n/(2*10^k - 1)]/(Floor[ n/(2*10^k - 1)] - 1/10)], {k, Floor[ Log10[ n]] }]}, Mod[q, 10]*11^c*10^Floor[ Log10[ q]] + Sum[ Floor[ Mod[q, 10^(k + 1)]/10^k]*10^(Floor[ Log10[ q]] - k) (10^(2 k + c) + 1) , {k, Floor[ Log10[ q]] }]] (* after the work of Eric A. Schmidt, see A002113 *) s = {0}; f[s_List] := Block[{k = s[[-1]] + 1}, Append[s, nthPalindrome[ k]]]; Nest[f, s, 18] (* Robert G. Wilson v, Sep 22 2014 *)
  • Python
    from itertools import islice
    def A246008_gen(): # generator of terms
        a, b, k = 0, 1, 2
        yield 0
        while True:
            yield b
            a, b = b, int((c:=k-x)*x+int(str(c)[-2::-1] or 0) if (k:=k+b-a)<(x:=10**(len(str(k>>1))-1))+(y:=10*x) else (c:=k-y)*y+int(str(c)[::-1] or 0))
    A246008_list = list(islice(A246008_gen(),22)) # Chai Wah Wu, Jul 10 2024

Extensions

a(16)-a(17) from Hiroaki Yamanouchi, Sep 21 2014
Edited by N. J. A. Sloane, Oct 01 2014

A248753 Palindromes p = A002113(n) whose index n is a substring of p.

Original entry on oeis.org

11, 1111, 12221, 23332, 34443, 45554, 56665, 67776, 78887, 89998, 101101, 111111, 121121, 131131, 141141, 151151, 161161, 171171, 181181, 191191, 1020201, 1121211, 1222221, 1323231, 1424241, 1525251, 1626261, 1727271, 1828281, 1929291, 2030302, 2131312
Offset: 1

Views

Author

Robert G. Wilson v, Oct 13 2014

Keywords

Comments

That is to say the 'n' of A002113(n) is a substring of A002113(n).

Examples

			11 is a term because the eleventh palindrome is 11.
12221 is in the sequence because the 222nd palindrome is 12221.
101101 is a member because it is the 1101st palindrome.
		

Crossrefs

Programs

  • Mathematica
    (* first load 'nthPalindrome' from A002113 and then *) nPal[n_] := nthPalindrome[n - 1]; fQ[n_] := StringPosition[ ToString[ nPal[ n]], ToString[ n]] != {}; k = 1; lst = {}; While[k < 3001, If[fQ[k], AppendTo[lst, nPal[ k]]]; k++]; lst
  • Python
    from itertools import count, islice
    def A248753_gen(startvalue=2): # generator of terms >= startvalue
        def f(n):
            y = 10*(x:=10**(len(str(n>>1))-1))
            return (c:=n-x)*x+int(str(c)[-2::-1] or 0) if nA248753_list = list(islice(A248753_gen(),32)) # Chai Wah Wu, Jul 24 2024

A248754 Palindromes p=A002113(n) whose index n is also a palindrome and in addition a substring of p (strings in base 10).

Original entry on oeis.org

11, 1111, 12221, 23332, 34443, 45554, 56665, 67776, 78887, 89998, 111111, 1222221, 2333332, 3444443, 4555554, 5666665, 6777776, 7888887, 8999998, 9101019, 11111111, 102020201, 112121211, 122222221, 132323231, 142424241, 152525251, 162626261, 172727271, 182828281
Offset: 1

Views

Author

Robert G. Wilson v, Oct 13 2014

Keywords

Comments

This is a proper subsequence of A248753 (where the index does not need to be palindromic).

Examples

			11 is a term because the eleventh palindrome is 11.
1111 is a member because it is the 111th palindrome.
12221 is in the sequence because the 222nd palindrome is 12221.
		

Crossrefs

Programs

  • Mathematica
    (* first load 'nthPalindrome' from A002113 and then *) nPal[n_] := nthPalindrome[n - 1];  fQ[n_] := StringPosition[ ToString[ nPal[ nPal[ k]]], ToString[ nPal[ n]]] != {}; k = 2; lst = {}; While[k < 501, If[ fQ[k], AppendTo[lst, nPal[ nPal[ k]] ]]; k++]; lst
  • Python
    from itertools import count, islice
    def A248754_gen(): # generator of terms
        def f(n):
            y = 10*(x:=10**(len(str(n>>1))-1))
            return (c:=n-x)*x+int(str(c)[-2::-1] or 0) if nA248754_list = list(islice(A248754_gen(),30)) # Chai Wah Wu, Jul 24 2024

A286138 Pseudo-palindromic numbers: not palindromes (A002113), but a nontrivial palindromic concatenation (AA or ABA) of arbitrary nonzero integers A and B.

Original entry on oeis.org

1010, 1101, 1121, 1131, 1141, 1151, 1161, 1171, 1181, 1191, 1201, 1211, 1212, 1231, 1241, 1251, 1261, 1271, 1281, 1291, 1301, 1311, 1313, 1321, 1341, 1351, 1361, 1371, 1381, 1391, 1401, 1411, 1414, 1421, 1431, 1451, 1461, 1471, 1481, 1491, 1501, 1511, 1515, 1521, 1531
Offset: 1

Views

Author

M. F. Hasler, May 03 2017

Keywords

Comments

The pseudo- or almost-palindromic numbers considered here are not related to the similarly named but different concepts mentioned in comments on A003555 and in A060087 - A060088.
We could consider "more general" palindromic concatenations like A.B.B.A, A.B.C.B.A, etc., but all of these can be written as A.B'.A with B' = B.B resp. B.C.B, etc. The result is non-palindromic (i.e., not in A002113) as required, if and only if at least one of the strings is non-palindromic.
Here, A is allowed to have only one digit, so most of the first 100 terms are of the form 1.B.1 where B = 10, 12, 13, ... (palindromes 11, 22, 33, ... excluded).
If all of the strings A, B (...) are required to be non-palindromic, the sequence starts with terms of the form A.A with A = 10, 12, 13, ..., 98: 1010, 1212, 1313, 1414, 1515, 1616, 1717, 1818, 1919, 2020, 2121, 2323, .... This is a subsequence of A239019 (numbers which are not primitive words over the alphabet {0,...,9} when written in base 10).

Programs

  • PARI
    A286138 = select(t->!is_A002113(t),setunion(vector(801,i,((i-1)\89+1)*1001+((i-1)%89+1)*10),vector(89,i,(i+9)*101))) \\ The first 810 terms.

A302663 Lexicographically first sequence of distinct terms such that the absolute differences |a(n) - a(n+1)| are A002113(n+1), where A002113 is "the palindromes in base 10".

Original entry on oeis.org

1, 2, 4, 7, 3, 8, 14, 21, 13, 22, 11, 33, 66, 110, 55, 121, 44, 132, 231, 130, 19, 140, 9, 150, 301, 462, 291, 472, 281, 483, 271, 493, 261, 503, 251, 513, 241, 523, 815, 512, 199, 522, 189, 532, 179, 542, 169, 552, 159, 563, 149, 573, 139, 583, 129, 593, 119, 603, 109, 614, 99, 624, 89, 634, 79, 644
Offset: 1

Views

Author

Eric Angelini and Jean-Marc Falcoz, Apr 11 2018

Keywords

Comments

The sequence starts with a(1) = 1 and is always extended with the smallest integer not yet present that doesn't lead to a contradiction.

Examples

			|1 - 2| = 1, which is the 2nd palindrome of A002113 (the 1st one being "0");
|2 - 4| = 2 which is the 3rd palindrome;
|4 - 7| = 3 which is the 4th palindrome;
|7 - 3| = 4 which is the 5th palindrome;
|3 - 8| = 5 which is the 6th palindrome;
|8 - 14| = 6 which is the 7th palindrome;
|14 - 21| = 7 which is the 8th palindrome;
|21 - 13| = 8 which is the 9th palindrome;
|13 - 22| = 9 which is the 10th palindrome;
|22 - 11| = 11 which is the 11th palindrome;
|11 - 33| = 22 which is the 12th palindrome; etc.
		

Crossrefs

Cf. A002113 (palindromes in base 10).

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

A353703 Palindromes (A002113) in A157037.

Original entry on oeis.org

6, 22, 66, 202, 222, 282, 434, 454, 474, 494, 555, 595, 838, 858, 969, 1001, 1551, 1771, 3333, 3553, 5335, 6006, 6226, 6886, 8778, 9889, 12921, 14541, 15051, 16261, 16761, 17171, 18681, 19491, 20202, 20602, 20802, 20902, 24142, 24242, 24542, 28282, 28482, 30003
Offset: 1

Views

Author

Marius A. Burtea, May 08 2022

Keywords

Comments

Intersection of A002113 and A157037.

Examples

			22 = A002113(12) and 22 = A157037(3), so 22 is a term.
66 = A002113(16) and 22 = A157037(8), so 66 is a term.
		

Crossrefs

Programs

  • Magma
    f:=func; pal:=func; [n:n in [2..30003]| pal(n) and IsPrime(Floor(f(n)))];
    
  • Maple
    filter:= proc(n) local t;
      isprime(n*add(t[2]/t[1], t=ifactors(n)[2]))
    end proc:
    digrev:= proc(n) local L,i;
      L:= convert(n,base,10);
      add(L[-i]*10^(i-1),i=1..nops(L))
    end proc:
    N:= 100: # for a(1) to a(N)
    Res:= 6: count:= 1:
    for d from 2 while count < N do
      if d::even then
        m:= d/2;
        for n from 10^(m-1) to 10^m-1 while count < N do
          v:=  n*10^m + digrev(n);
          if filter(v) then Res:= Res,v; count:= count+1  fi;
        od
      else
        m:= (d-1)/2;
        for n from 10^(m-1) to 10^m-1 while count < N do
          for y from 0 to 9 while count < N do
            v:= n*10^(m+1)+y*10^m+digrev(n);
            if filter(v) then Res:= Res,v; count:= count+1 fi;
        od od:
      fi
    od:
    Res; # Robert Israel, May 09 2023
  • Mathematica
    d[0] = d[1] = 0; d[n_] := n * Plus @@ ((Last[#]/First[#]) & /@ FactorInteger[n]); Select[Range[30003], PalindromeQ[#] && PrimeQ[d[#]] &] (* Amiram Eldar, May 09 2022 *)
  • PARI
    ad(n) = vecsum([n/f[1]*f[2]|f<-factor(n+!n)~]); \\ A003415
    isok(m) = my(d); isprime(ad(m)) && (d=digits(m)) && (d==Vecrev(d)); \\ Michel Marcus, May 09 2022
    
  • Python
    from itertools import chain, count, islice
    from sympy import isprime, factorint
    def A353703_gen(): # generator of terms
        return filter(lambda n:isprime(sum(n*e//p for p,e in factorint(n).items())), 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)))
    A353703_list = list(islice(A353703_gen(),20)) # Chai Wah Wu, Jun 23 2022
Previous Showing 11-20 of 829 results. Next