A065846 Let u be any string of n digits from {0,...,4}; let f(u) = number of distinct primes, not beginning with 0, formed by permuting the digits of u to a base-5 number; then a(n) = max_u f(u).
1, 2, 4, 7, 26, 87, 226, 800, 2424, 9975, 40045, 152852, 626232, 2317403, 9962949, 43599477, 179247754, 777881238
Offset: 1
Examples
a(2)=2 because 12 and 21 (written in base 5) are primes (7 and 11).
Crossrefs
Programs
-
Maple
A065846 := proc(n) local b,u,udgs,uperm,a; b :=5 ; 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,A065846(n)) ; end do: # R. J. Mathar, Apr 23 2016
-
Mathematica
c[x_] := Module[{}, Length[Select[Permutations[x], First[#] != 0 && PrimeQ[FromDigits[#, 5]] &]]]; A065846[n_] := Module[{i}, Return[Max[Map[c, DeleteDuplicatesBy[Tuples[Range[0, 4], n], Table[Count[#, i], {i, 0, 4}] &]]]]]; Table[A065846[n], {n, 1, 9}] (* Robert Price, Mar 30 2019 *)
Extensions
2 more terms from Sean A. Irvine, Sep 06 2009
Definition corrected by David A. Corneth, Apr 23 2016
a(16) from Michael S. Branicky, May 29 2024
a(17) from Michael S. Branicky, Jun 26 2024
a(18) from Michael S. Branicky, Jul 08 2024