OFFSET
1,4
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
FORMULA
a(n) = A101991(n^2). - Michel Marcus, Oct 05 2013
EXAMPLE
a(11)=211 because 211 is the largest prime which can be made from digits of 11*11=121: {1,1,2}.
MAPLE
f:= proc(n) local L, N, d, i, j, S, s, p;
L:= convert(n^2, base, 10);
N:= nops(L);
for d from N to 1 by -1 do
S:= sort(combinat:-permute(L, d));
for i from nops(S) to 1 by -1 do
s:= S[i];
p:= add(s[j]*10^(d-j), j=1..d);
if isprime(p) then return p fi
od od;
0
end proc:
map(f, [$1..100]); # Robert Israel, Jan 10 2024
MATHEMATICA
a[n_]:=Max[0, Select[FromDigits/@Permutations[IntegerDigits[n^2], {1, IntegerLength[n^2]}], PrimeQ]]; Table[a[n], {n, 60}] (* James C. McMahon, Jan 09 2024 *)
CROSSREFS
KEYWORD
AUTHOR
Zak Seidov, Jan 29 2005
EXTENSIONS
Data corrected for n={18,33,39,57} by James C. McMahon, Jan 10 2024.
STATUS
approved