OFFSET
0,2
COMMENTS
Leading zeros are not allowed.
LINKS
Robert Israel, Table of n, a(n) for n = 0..559
FORMULA
A393958(a(n)) = n.
EXAMPLE
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.
MAPLE
g:= proc(n) local d, F, i;
F:= convert(n, base, 10); d:= nops(F);
map(t -> n + add(t[i]*10^(i-1), i=1..d), select( t -> t[-1] <> 0, combinat:-permute(F)))
end proc:
N:= 1000000: V:= Vector(N):
for p in select(isprime, [2, seq(i, i=3..N, 2)]) do
v:= select(`<=`, g(p), N);
V[v]:= V[v]+~ 1
od:
R:= Array(0..max(V)):
for i from 1 to N do
if R[V[i]] = 0 then R[V[i]]:= i fi
od:
if not member(0, R, 'k0') then k0:= max(V)+1 fi;
convert(R[0..k0-1], list);
CROSSREFS
KEYWORD
AUTHOR
Robert Israel, Mar 04 2026
STATUS
approved
