Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #31 Jul 08 2024 10:38:58
%S 1,2,4,7,26,87,226,800,2424,9975,40045,152852,626232,2317403,9962949,
%T 43599477,179247754,777881238
%N 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).
%e a(2)=2 because 12 and 21 (written in base 5) are primes (7 and 11).
%p A065846 := proc(n)
%p local b,u,udgs,uperm,a;
%p b :=5 ;
%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,A065846(n)) ;
%p end do: # _R. J. Mathar_, Apr 23 2016
%t c[x_] := Module[{},
%t Length[Select[Permutations[x],
%t First[#] != 0 && PrimeQ[FromDigits[#, 5]] &]]];
%t A065846[n_] := Module[{i},
%t Return[Max[Map[c, DeleteDuplicatesBy[Tuples[Range[0, 4], n],
%t Table[Count[#, i], {i, 0, 4}] &]]]]];
%t Table[A065846[n], {n, 1, 9}] (* _Robert Price_, Mar 30 2019 *)
%Y Cf. A065843, A065844, A065845, A065847, A065848, A065849, A065850, A065851, A065852, A065853.
%K base,more,nonn
%O 1,2
%A _Sascha Kurz_, Nov 24 2001
%E 2 more terms from _Sean A. Irvine_, Sep 06 2009
%E Definition corrected by _David A. Corneth_, Apr 23 2016
%E a(16) from _Michael S. Branicky_, May 29 2024
%E a(17) from _Michael S. Branicky_, Jun 26 2024
%E a(18) from _Michael S. Branicky_, Jul 08 2024