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.

A046942 Numbers k such that k and prime(k) are both palindromes.

Original entry on oeis.org

1, 2, 3, 4, 5, 8114118, 535252535, 4025062605204
Offset: 1

Views

Author

Keywords

Comments

Previous name: Indices of primes appearing in A046941.
Also, intersection of A002113 and A075807. - Ivan Neretin, Jun 02 2016

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]]]] ]]]];
    p = 0; Do[p = NextPalindrome[p]; While[ !PrimeQ[p], p = NextPalindrome[ p]]; q = IntegerDigits[ PrimePi[ p]]; If[Reverse[q] == q, Print[{p, FromDigits[q]}]], {n, 10^4}] (* Robert G. Wilson v, Feb 03 2005 *)
    ParallelDo[If [PalindromeQ @ i && PalindromeQ @ Prime @i, Print @i], {i, 6*10^8}] (* Mikk Heidemaa, May 24 2024 *)

Extensions

a(7) from Giovanni Resta, May 14 2003
New name and offset by Ivan Neretin, Jun 02 2016
a(8) from Giovanni Resta, Aug 10 2019