%I #20 Mar 31 2019 02:17:21
%S 1,2,3,6,13,36,96,253,765,2683,7385,25075,83150,293063,888689,3161645,
%T 11097301,40328876
%N Let u be any string of n digits from {0,...,3}; let f(u) = number of distinct primes, not beginning with 0, formed by permuting the digits of u; then a(n) = max_u f(u).
%e a(2)=2 because 13 and 31 (written in base 4) are primes (7 and 13).
%p A065845 := proc(n)
%p local b,u,udgs,uperm,a;
%p b :=4 ;
%p a := 0 ;
%p for u from b^(n-1) to b^n-1 do
%p udgs := convert(u,base,b) ;
%p prs := {} ;
%p for uperm in combinat[permute](udgs) do
%p if op(-1,uperm) <> 0 then
%p p := add( op(i,uperm)*b^(i-1),i=1..nops(uperm)) ;
%p if isprime(p) then
%p prs := prs union {p} ;
%p end if;
%p end if;
%p end do:
%p a := max(a,nops(prs)) ;
%p end do:
%p a ;
%p end proc:
%p for n from 1 do
%p print(n,A065845(n)) ;
%p end do: # _R. J. Mathar_, Apr 23 2016
%t c[x_] := Module[{},
%t Length[Select[Permutations[x],
%t First[#] != 0 && PrimeQ[FromDigits[#, 4]] &]]];
%t A065845[n_] := Module[{i},
%t Return[Max[Map[c, DeleteDuplicatesBy[Tuples[Range[0, 3], n],
%t Table[Count[#, i], {i, 0, 3}] &]]]]];
%t Table[A065845[n], {n, 1, 10}] (* _Robert Price_, Mar 30 2019 *)
%Y Cf. A065843, A065844, A065846, A065847, A065848, A065849, A065850, A065851, A065852, A065853
%K base,more,nonn
%O 1,2
%A _Sascha Kurz_, Nov 24 2001
%E 3 more terms from _Sean A. Irvine_, Sep 06 2009
%E Definition corrected by _David A. Corneth_, Apr 23 2016
|