cp's OEIS Frontend

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.

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).

This page as a plain text file.
%I A065846 #31 Jul 08 2024 10:38:58
%S A065846 1,2,4,7,26,87,226,800,2424,9975,40045,152852,626232,2317403,9962949,
%T A065846 43599477,179247754,777881238
%N 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).
%e A065846 a(2)=2 because 12 and 21 (written in base 5) are primes (7 and 11).
%p A065846 A065846 := proc(n)
%p A065846     local b,u,udgs,uperm,a;
%p A065846     b :=5 ;
%p A065846     a := 0 ;
%p A065846     for u from b^(n-1) to b^n-1 do
%p A065846         udgs := convert(u,base,b) ;
%p A065846         prs := {} ;
%p A065846         for uperm in combinat[permute](udgs) do
%p A065846             if op(-1,uperm) <> 0 then
%p A065846                 p := add( op(i,uperm)*b^(i-1),i=1..nops(uperm)) ;
%p A065846                 if isprime(p) then
%p A065846                     prs := prs union {p} ;
%p A065846                 end if;
%p A065846             end if;
%p A065846         end do:
%p A065846         a := max(a,nops(prs)) ;
%p A065846     end do:
%p A065846     a ;
%p A065846 end proc:
%p A065846 for n from 1 do
%p A065846     print(n,A065846(n)) ;
%p A065846 end do: # _R. J. Mathar_, Apr 23 2016
%t A065846 c[x_] := Module[{},
%t A065846    Length[Select[Permutations[x],
%t A065846      First[#] != 0 && PrimeQ[FromDigits[#, 5]] &]]];
%t A065846 A065846[n_] := Module[{i},
%t A065846    Return[Max[Map[c, DeleteDuplicatesBy[Tuples[Range[0, 4], n],
%t A065846        Table[Count[#, i], {i, 0, 4}] &]]]]];
%t A065846 Table[A065846[n], {n, 1, 9}] (* _Robert Price_, Mar 30 2019 *)
%Y A065846 Cf. A065843, A065844, A065845, A065847, A065848, A065849, A065850, A065851, A065852, A065853.
%K A065846 base,more,nonn
%O A065846 1,2
%A A065846 _Sascha Kurz_, Nov 24 2001
%E A065846 2 more terms from _Sean A. Irvine_, Sep 06 2009
%E A065846 Definition corrected by _David A. Corneth_, Apr 23 2016
%E A065846 a(16) from _Michael S. Branicky_, May 29 2024
%E A065846 a(17) from _Michael S. Branicky_, Jun 26 2024
%E A065846 a(18) from _Michael S. Branicky_, Jul 08 2024