login
a(n) is the least number that can be written in exactly n ways as p + r, where p is a prime and r is an anagram of p.
3

%I #32 Mar 12 2026 15:54:43

%S 1,4,44,88,299,898,776,1106,5008,4994,6325,5654,5104,6776,8888,8998,

%T 9494,8585,10706,43444,11009,12625,26666,44554,50504,31211,53332,

%U 66556,54443,54344,39998,11110,28888,67777,55556,32221,33332,91108,55564,89908,108088,106706,107062,89888,71110,66662

%N a(n) is the least number that can be written in exactly n ways as p + r, where p is a prime and r is an anagram of p.

%C Leading zeros are not allowed.

%H Robert Israel, <a href="/A392563/b392563.txt">Table of n, a(n) for n = 0..559</a>

%F A393958(a(n)) = n.

%e a(5) = 898 because 898 = 179 + 719 = 269 + 629 = 359 + 539 = 449 + 449 = 719 + 179 can be written in exactly 5 ways as the sum of a prime and an anagram of that prime, and 898 is the least number that works.

%p g:= proc(n) local d,F,i;

%p F:= convert(n,base,10); d:= nops(F);

%p map(t -> n + add(t[i]*10^(i-1),i=1..d), select( t -> t[-1] <> 0, combinat:-permute(F)))

%p end proc:

%p N:= 1000000: V:= Vector(N):

%p for p in select(isprime,[2,seq(i,i=3..N,2)]) do

%p v:= select(`<=`,g(p),N);

%p V[v]:= V[v]+~ 1

%p od:

%p R:= Array(0..max(V)):

%p for i from 1 to N do

%p if R[V[i]] = 0 then R[V[i]]:= i fi

%p od:

%p if not member(0,R,'k0') then k0:= max(V)+1 fi;

%p convert(R[0..k0-1],list);

%Y Cf. A393958.

%K nonn,base,look

%O 0,2

%A _Robert Israel_, Mar 04 2026