login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

a(n) is the least prime that starts a sequence of exactly n primes under the iteration p -> p + reverse(p) + 1.
0

%I #23 Mar 05 2022 04:03:12

%S 7,3,5,2,7070879,700839449,7700584787999

%N a(n) is the least prime that starts a sequence of exactly n primes under the iteration p -> p + reverse(p) + 1.

%e a(3) = 5 because 5 starts the sequence of 3 primes 5 -> 5+5+1 = 11 -> 11+11+1 = 23, the next iteration 23+32+1 = 56 not being prime.

%p rev:= proc(x) local L,i;

%p L:= convert(x,base,10);

%p add(L[-i]*10^(i-1),i=1..nops(L))

%p end proc:

%p f:= proc(n) option remember;

%p local x;

%p x:= n + rev(n)+1;

%p if isprime(x) then 1+procname(x) else 1 fi

%p end proc:

%p W:= Array(1..5):

%p p:= 1: count:= 0:

%p while count < 5 do

%p p:= nextprime(p);

%p v:= f(p);

%p if W[v] = 0 then W[v]:= p; count:= count+1 fi

%p od:

%p convert(W,list);

%t With[{s = Array[-1 + Length@ NestWhileList[# + IntegerReverse[#] + 1 &, #, PrimeQ] &, 2^23]}, Array[FirstPosition[s, #][[1]] &, 5]] (* _Michael De Vlieger_, Feb 17 2022 *)

%Y Cf. A004086, A056964.

%K nonn,base,more

%O 1,1

%A _Robert Israel_, Feb 17 2022

%E a(6)-a(7) from _Martin Ehrenstein_, Mar 05 2022