login
A065845
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 to a base-4 number; then a(n) = max_u f(u).
11
1, 2, 3, 6, 13, 36, 96, 253, 765, 2683, 7385, 25075, 83150, 293063, 888689, 3161645, 11097301, 40328876, 129951350, 469528189, 1694632516
OFFSET
1,2
EXAMPLE
a(2)=2 because 13 and 31 (written in base 4) are primes (7 and 13).
MAPLE
A065845 := proc(n)
local b, u, udgs, uperm, a;
b :=4 ;
a := 0 ;
for u from b^(n-1) to b^n-1 do
udgs := convert(u, base, b) ;
prs := {} ;
for uperm in combinat[permute](udgs) do
if op(-1, uperm) <> 0 then
p := add( op(i, uperm)*b^(i-1), i=1..nops(uperm)) ;
if isprime(p) then
prs := prs union {p} ;
end if;
end if;
end do:
a := max(a, nops(prs)) ;
end do:
a ;
end proc:
for n from 1 do
print(n, A065845(n)) ;
end do: # R. J. Mathar, Apr 23 2016
MATHEMATICA
c[x_] := Module[{},
Length[Select[Permutations[x],
First[#] != 0 && PrimeQ[FromDigits[#, 4]] &]]];
A065845[n_] := Module[{i},
Return[Max[Map[c, DeleteDuplicatesBy[Tuples[Range[0, 3], n],
Table[Count[#, i], {i, 0, 3}] &]]]]];
Table[A065845[n], {n, 1, 10}] (* Robert Price, Mar 30 2019 *)
KEYWORD
base,more,nonn
AUTHOR
Sascha Kurz, Nov 24 2001
EXTENSIONS
3 more terms from Sean A. Irvine, Sep 06 2009
Definition corrected by David A. Corneth, Apr 23 2016
a(19) from Michael S. Branicky, May 29 2024
a(20)-a(21) from Michael S. Branicky, Jun 14 2024
STATUS
approved