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!)
A078790 Palindromic primes with successive increasing difference: a(k)-a(k-1) < a(k+1)- a(k). 2

%I #8 Jan 31 2019 19:38:16

%S 2,5,11,101,313,727,10301,19891,30103,70207,1003001,1936391,3001003,

%T 7014107,100030001,193191391,300020003,700020007,10000500001,

%U 19301110391,30000500003,70005450007,1000008000001,1930022200391,3000002000003,7000005000007,100000323000001

%N Palindromic primes with successive increasing difference: a(k)-a(k-1) < a(k+1)- a(k).

%H Robert Israel, <a href="/A078790/b078790.txt">Table of n, a(n) for n = 1..1600</a>

%p revdigs:= proc(x) local F,i;

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

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

%p end proc:

%p f1:= proc(n)

%p local m0, a0,b0,m,a,b,c,x;

%p m0:= ilog10(n)+1;

%p if m0::even then m:= m0/2+1; a0:= 1; b0:= 0;

%p else a0:= floor(n/10^(m0-1));

%p if a0 = 4 or a0 = 5 then a0:= 7; b0:= 0

%p elif a0::odd then b0:= n - 10^(m0-1)*a0;

%p else a0:= a0+1; b0:= 0;

%p fi;

%p m:= ceil(m0/2); b0:= floor(b0/10^(m-1));

%p fi;

%p for a from a0 to 9 by 2 do

%p for b from b0 to 10^(m-1) do

%p x:= 10^(m-1)*a + b;

%p x:= 10^(m-1)*x + revdigs(floor(x/10));

%p if x < n then next fi;

%p if isprime(x) then return x fi

%p od;

%p b0:= 0;

%p od;

%p procname(10^m0);

%p end proc;

%p A[1]:= 2: A[2]:= 5: A[3]:= 11:

%p for n from 4 to 30 do

%p A[n]:= f1(2*A[n-1]-A[n-2]+1);

%p od:

%p seq(A[i],i=1..30); # _Robert Israel_, Jan 31 2019

%t p = 1; d = 0; Do[ q = FromDigits[ Join[ IntegerDigits[n], Drop[ Reverse[ IntegerDigits[n]], 1]]]; If[ PrimeQ[q] && q - p > d, Print[q]; d = q - p; p = q], {n, 2, 3000002}]

%Y Cf. A071250.

%K base,nonn

%O 1,1

%A _Robert G. Wilson v_, Dec 03 2002

%E Corrected by _T. D. Noe_, Oct 25 2006

%E Corrected and more terms from _Robert Israel_, Jan 31 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 25 05:18 EDT 2024. Contains 371964 sequences. (Running on oeis4.)