This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A065847 #37 Jul 02 2024 14:50:39 %S A065847 1,2,4,8,21,60,269,1147,4250,17883,71966,342060,1724337,8428101, %T A065847 37186164,175845403 %N A065847 Let u be any string of n digits from {0,...,5}; let f(u) = number of distinct primes, not beginning with 0, formed by permuting the digits of u to a base-6 number; then a(n) = max_u f(u). %e A065847 a(2)=2 because 15 and 51 (written in base 6) are primes (11 and 31). %p A065847 A065847 := proc(n) %p A065847 local b,u,udgs,uperm,a; %p A065847 b :=6 ; %p A065847 a := 0 ; %p A065847 for u from b^(n-1) to b^n-1 do %p A065847 udgs := convert(u,base,b) ; %p A065847 prs := {} ; %p A065847 for uperm in combinat[permute](udgs) do %p A065847 if op(-1,uperm) <> 0 then %p A065847 p := add( op(i,uperm)*b^(i-1),i=1..nops(uperm)) ; %p A065847 if isprime(p) then %p A065847 prs := prs union {p} ; %p A065847 end if; %p A065847 end if; %p A065847 end do: %p A065847 a := max(a,nops(prs)) ; %p A065847 end do: %p A065847 a ; %p A065847 end proc: %p A065847 for n from 1 do %p A065847 print(n,A065847(n)) ; %p A065847 end do: # _R. J. Mathar_, Apr 23 2016 %t A065847 c[x_] := Module[{}, %t A065847 Length[Select[Permutations[x], %t A065847 First[#] != 0 && PrimeQ[FromDigits[#, 6]] &]]]; %t A065847 A065847[n_] := Module[{i}, %t A065847 Return[Max[Map[c, DeleteDuplicatesBy[Tuples[Range[0, 5], n], %t A065847 Table[Count[#, i], {i, 0, 5}] &]]]]]; %t A065847 Table[A065847[n], {n, 1, 8}] (* _Robert Price_, Mar 30 2019 *) %o A065847 (Python) %o A065847 from sympy import isprime %o A065847 from sympy.utilities.iterables import multiset_permutations %o A065847 from itertools import combinations_with_replacement %o A065847 def A065847(n): %o A065847 return max(sum(1 for t in multiset_permutations(s) if t[0] != '0' and isprime(int(''.join(t),6))) for s in combinations_with_replacement('012345',n)) # _Chai Wah Wu_, Apr 23 2019 %Y A065847 Cf. A065843, A065844, A065845, A065846, A065848, A065849, A065850, A065851, A065852, A065853. %K A065847 base,more,nonn %O A065847 1,2 %A A065847 _Sascha Kurz_, Nov 24 2001 %E A065847 a(12)-a(13) from _Sean A. Irvine_, Sep 06 2009 %E A065847 Definition corrected by _David A. Corneth_, Apr 23 2016 %E A065847 a(14) from _Chai Wah Wu_, Jun 15 2019 %E A065847 a(15) from _Michael S. Branicky_, Jun 25 2024 %E A065847 a(16) from _Michael S. Branicky_, Jul 02 2024