login
a(n) is the first number that is the sum of two palindromic primes in exactly n ways.
1

%I #7 Dec 16 2024 02:15:38

%S 0,4,10,504,25242,1110,28782,46764,46254,86058,50094,47874,107880,

%T 108180,110100,108990,107070,109800,2726262,2830272,2698962,3029292,

%U 2900982,2799972,2979792,3100002,2998992,4498944,4409034,4709064,4510044,4916184,4790874,4787874,4869684,4959594,4896984,4891884

%N a(n) is the first number that is the sum of two palindromic primes in exactly n ways.

%C a(n) is the least k such that there are exactly n numbers j <= k/2 where both j and k - j are in A002385.

%e a(5) = 1110 because 1110 = 181 + 929 = 191 + 919 = 313 + 797 = 353 + 757 = 383 + 727 is the sum of two palindromic primes in exactly 5 ways, and no smaller even number works.

%p digrev:= proc(n) local L,i;

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

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

%p end proc:

%p F:= proc(d) # d-digit odd palindromic primes, d >= 3

%p local R,x,rx,i;

%p select(isprime,map(t -> seq(10^((d+1)/2)*t + i*10^((d-1)/2) + digrev(t),i=0..9), [$(10^((d-3)/2)) .. 10^((d-1)/2)-1]))

%p end proc:

%p PP:= [3,5,7,11,op(F(3)),op(F(5)),op(F(7))]: nPP:= nops(PP):

%p V:= Vector(2*PP[-1],datatype=integer[1]):

%p for i from 1 to nPP do for j from 1 to i do

%p x:= PP[i]+PP[j];

%p V[x]:= V[x]+1

%p od od:

%p M:= max(V):

%p W:= Array(0..M,-1):

%p W[0]:= 0: W[1]:= 4:

%p for x from 1 to 2*PP[-1] do

%p if W[V[x]] = -1 then W[V[x]]:= x fi

%p od:

%p convert(W,list); # entries of -1 indicate values > 10^8

%Y Cf. A002385, A377848.

%K nonn

%O 0,2

%A _Robert Israel_, Dec 15 2024