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!)
A102600 Largest prime which can be formed from digits of n^2, or 0, if no prime. 1

%I #24 Jan 10 2024 16:36:49

%S 0,0,0,61,5,3,0,0,0,0,211,41,691,691,5,5,829,43,631,0,41,0,59,67,5,67,

%T 97,487,41,0,691,4201,809,6151,2521,691,9631,4441,521,601,8161,761,

%U 8941,9631,5,6211,2029,43,4201,5,601,4027,8209,691,5023,6133,439,6343,8431,3

%N Largest prime which can be formed from digits of n^2, or 0, if no prime.

%H Robert Israel, <a href="/A102600/b102600.txt">Table of n, a(n) for n = 1..10000</a>

%F a(n) = A101991(n^2). - _Michel Marcus_, Oct 05 2013

%e a(11)=211 because 211 is the largest prime which can be made from digits of 11*11=121: {1,1,2}.

%p f:= proc(n) local L,N,d,i,j,S,s,p;

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

%p N:= nops(L);

%p for d from N to 1 by -1 do

%p S:= sort(combinat:-permute(L,d));

%p for i from nops(S) to 1 by -1 do

%p s:= S[i];

%p p:= add(s[j]*10^(d-j),j=1..d);

%p if isprime(p) then return p fi

%p od od;

%p 0

%p end proc:

%p map(f, [$1..100]); # _Robert Israel_, Jan 10 2024

%t 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 *)

%Y Cf. A101991.

%K base,easy,nonn,look

%O 1,4

%A _Zak Seidov_, Jan 29 2005

%E Data corrected for n={18,33,39,57} by _James C. McMahon_, Jan 10 2024.

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 16 14:17 EDT 2024. Contains 371740 sequences. (Running on oeis4.)