# Greetings from The On-Line Encyclopedia of Integer Sequences! http://oeis.org/ Search: id:a065845 Showing 1-1 of 1 %I A065845 #31 Jun 23 2024 11:51:16 %S A065845 1,2,3,6,13,36,96,253,765,2683,7385,25075,83150,293063,888689,3161645, %T A065845 11097301,40328876,129951350,469528189,1694632516 %N 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). %e A065845 a(2)=2 because 13 and 31 (written in base 4) are primes (7 and 13). %p A065845 A065845 := proc(n) %p A065845 local b,u,udgs,uperm,a; %p A065845 b :=4 ; %p A065845 a := 0 ; %p A065845 for u from b^(n-1) to b^n-1 do %p A065845 udgs := convert(u,base,b) ; %p A065845 prs := {} ; %p A065845 for uperm in combinat[permute](udgs) do %p A065845 if op(-1,uperm) <> 0 then %p A065845 p := add( op(i,uperm)*b^(i-1),i=1..nops(uperm)) ; %p A065845 if isprime(p) then %p A065845 prs := prs union {p} ; %p A065845 end if; %p A065845 end if; %p A065845 end do: %p A065845 a := max(a,nops(prs)) ; %p A065845 end do: %p A065845 a ; %p A065845 end proc: %p A065845 for n from 1 do %p A065845 print(n,A065845(n)) ; %p A065845 end do: # _R. J. Mathar_, Apr 23 2016 %t A065845 c[x_] := Module[{}, %t A065845 Length[Select[Permutations[x], %t A065845 First[#] != 0 && PrimeQ[FromDigits[#, 4]] &]]]; %t A065845 A065845[n_] := Module[{i}, %t A065845 Return[Max[Map[c, DeleteDuplicatesBy[Tuples[Range[0, 3], n], %t A065845 Table[Count[#, i], {i, 0, 3}] &]]]]]; %t A065845 Table[A065845[n], {n, 1, 10}] (* _Robert Price_, Mar 30 2019 *) %Y A065845 Cf. A065843, A065844, A065846, A065847, A065848, A065849, A065850, A065851, A065852, A065853 %K A065845 base,more,nonn %O A065845 1,2 %A A065845 _Sascha Kurz_, Nov 24 2001 %E A065845 3 more terms from _Sean A. Irvine_, Sep 06 2009 %E A065845 Definition corrected by _David A. Corneth_, Apr 23 2016 %E A065845 a(19) from _Michael S. Branicky_, May 29 2024 %E A065845 a(20)-a(21) from _Michael S. Branicky_, Jun 14 2024 # Content is available under The OEIS End-User License Agreement: http://oeis.org/LICENSE