[go: up one dir, main page]

login
Numbers n such that the base 10 reversals of n and n+1 are both prime.
1

%I #15 Jan 07 2024 15:26:43

%S 2,13,16,30,31,34,37,70,73,91,97,106,112,118,124,130,133,145,151,166,

%T 181,199,300,310,346,358,361,364,370,376,382,388,391,700,709,721,727,

%U 730,739,745,751,754,757,760,763,775,778,784,787,790,904,907,916,919

%N Numbers n such that the base 10 reversals of n and n+1 are both prime.

%C n such that n and n+1 are in A095179.

%C Leading 0's in the reversals are allowed.

%C Heuristically, the abundance of these numbers should be roughly similar to that of the twin primes. Thus the sequence should be infinite but the sum of the reciprocals should converge.

%C All terms == 1 (mod 3) except for 2 and 3*10^k where k is in A049054.

%H Robert Israel, <a href="/A257636/b257636.txt">Table of n, a(n) for n = 1..10000</a>

%H Math StackExchange, <a href="http://math.stackexchange.com/questions/1513275/consecutive-numbers-where-their-revers-numbers-are-primes/1513381#1513381">Consecutive numbers where their revers numbers are primes</a>

%e 13 is in the sequence because both 31 and 41 are prime.

%p revdigs:= proc(n) option remember; local x;

%p x:= n mod 10;

%p x*10^ilog10(n)+revdigs((n-x)/10);

%p end proc:

%p for i from 0 to 9 do revdigs(i):= i od:

%p Rprimes:= select(isprime@revdigs, [$1..10^4]):

%p Rprimes[select(t -> Rprimes[t+1]-Rprimes[t]=1, [$1..nops(Rprimes)-1])]; # _Robert Israel_, Nov 04 2015

%t SequencePosition[Table[If[PrimeQ[IntegerReverse[n]],1,0],{n,1000}],{1,1}][[;;,1]] (* _Harvey P. Dale_, Jan 07 2024 *)

%o (PARI) for(n=1, 1e3, if(isprime(eval(concat(Vecrev(Str(n))))) && isprime(eval(concat(Vecrev(Str(n+1))))), print1(n, ", "))) \\ _Altug Alkan_, Nov 04 2015

%Y Cf. A000040, A004086, A049054, A095179.

%K nonn,base

%O 1,1

%A _Robert Israel_, Nov 04 2015