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

A115884 Numbers k such that the k-th prime plus k gives a palindrome.

Original entry on oeis.org

1, 2, 3, 4, 22, 45, 66, 71, 75, 88, 94, 97, 103, 105, 116, 140, 331, 432, 454, 565, 646, 703, 795, 1042, 1108, 1168, 1248, 1334, 1644, 1652, 1864, 1874, 1900, 2181, 2295, 2323, 2485, 2509, 2585, 2679, 2835, 2899, 2923, 3052, 3360, 3372, 3396, 3404
Offset: 1

Views

Author

Giovanni Resta, Feb 06 2006

Keywords

Examples

			prime(103) + 103 = 666, a palindrome; so 103 is a term.
		

Crossrefs

Programs

  • Maple
    filter:= proc(n) local p,L;
       p:= ithprime(n)+n;
       L:= convert(p,base,10);
       ListTools:-Reverse(L) = L
    end proc:
    select(filter, [$1..10000]); # Robert Israel, Nov 04 2014
  • Mathematica
    palQ[n_]:=Module[{idn=IntegerDigits[n]},idn==Reverse[idn]]; With[ {nn=3500}, Rest[Flatten[Position[Total/@Thread[{Prime[Range[nn]], Range[nn]}],?(palQ)]]]] (* _Harvey P. Dale, Oct 11 2011 *)
    palQ[n_] := Reverse[x = IntegerDigits[n]] == x; Select[Range[3405], palQ[Prime[#] + #] &] (* Jayanta Basu, Jun 24 2013 *)
  • PARI
    ispal(n) = my(e=digits(n));e == Vecrev(e) \\ A002113
    for(k=1,10^6,b=k+prime(k);if(ispal(b),print1(k,", "))) \\ Alexandru Petrescu, Jun 15 2022
    
  • Python
    from sympy import nextprime
    def ispal(n): s = str(n); return s == s[::-1]
    def agen(): # generator of terms
        k, pk = 1, 2
        while True:
            if ispal(k+pk): yield k
            k, pk = k+1, nextprime(pk)
    g = agen()
    print([next(g) for n in range(1, 51)]) # Michael S. Branicky, Jun 15 2022

A115889 Palindromes equal to the difference between a prime number and its index.

Original entry on oeis.org

1, 2, 3, 6, 7, 11, 99, 202, 212, 222, 282, 373, 404, 424, 505, 525, 575, 626, 636, 848, 858, 909, 1221, 2002, 2332, 2442, 2772, 3003, 3883, 4224, 4884, 6116, 6556, 6886, 7007, 7227, 7337, 8778, 10201, 10901, 11111, 11411, 12021, 12421, 14541, 14941
Offset: 1

Views

Author

Giovanni Resta, Feb 06 2006

Keywords

Examples

			575=p(126)-126.
		

Crossrefs

Cf. A115885.

Programs

  • Mathematica
    Select[Union[Flatten[Differences/@Table[{n,Prime[n]},{n,3000}]]], PalindromeQ] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Sep 13 2020 *)

A115901 Numbers k such that prime(k) - k and prime(k) + k are palindromes.

Original entry on oeis.org

1, 2, 3, 4, 71, 116, 7271, 43585895
Offset: 1

Views

Author

Giovanni Resta, Feb 06 2006

Keywords

Comments

Intersection of A115884 and A115885.

Examples

			prime(43585895) - 43585895 = 806494608 and
prime(43585895) + 43585895 = 893666398.
		

Crossrefs

Showing 1-3 of 3 results.