login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A046942 Numbers n such that n and prime(n) are both palindromes. 7

%I #27 Aug 10 2019 14:55:28

%S 1,2,3,4,5,8114118,535252535,4025062605204

%N Numbers n such that n and prime(n) are both palindromes.

%C Previous name: Indices of primes appearing in A046941.

%C Also, intersection of A002113 and A075807. - _Ivan Neretin_, Jun 02 2016

%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/PalindromicPrime.html">Palindromic Prime</a>

%t 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]]]] ]]]];

%t 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 *)

%Y Equals pi(A046941).

%Y Cf. A046941, A103357, A103358, A103402, A103403.

%K nice,nonn,base

%O 1,2

%A _Carlos Rivera_

%E a(7) from _Giovanni Resta_, May 14 2003

%E New name and offset by _Ivan Neretin_, Jun 02 2016

%E a(8) from _Giovanni Resta_, Aug 10 2019

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 27 08:39 EDT 2024. Contains 372017 sequences. (Running on oeis4.)