login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A065844 Let u be any string of n digits from {0,1,2}; let f(u) = number of distinct primes, not beginning with 0, formed by permuting the digits of u; then a(n) = max_u f(u). 11

%I

%S 1,2,2,4,7,19,42,102,252,532,1226,3681,9100,24858,61943,161857,392935,

%T 1167208,3125539,8879693,23143081,63028550

%N Let u be any string of n digits from {0,1,2}; let f(u) = number of distinct primes, not beginning with 0, formed by permuting the digits of u; then a(n) = max_u f(u).

%e a(2)=2 because 12 and 21 (written in base 3) are primes (5 and 7).

%p A065844 := proc(n)

%p local b,u,udgs,uperm,a;

%p b :=3 ;

%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,A065844(n)) ;

%p end do: # _R. J. Mathar_, Apr 23 2016

%t c[x_] := Module[{},

%t Length[Select[Permutations[x],

%t First[#] != 0 && PrimeQ[FromDigits[#, 3]] &]]];

%t A065844[n_] := Module[{i},

%t Return[Max[Map[c, DeleteDuplicatesBy[Tuples[Range[0, 2], n],

%t Table[Count[#, i], {i, 0, 2}] &]]]]];

%t Table[A065844[n], {n, 1, 13}] (* _Robert Price_, Mar 30 2019 *)

%Y Cf. A065843, A065845, A065846, A065847, A065848, A065849, A065850, A065851, A065852, A065853

%K base,nonn,more

%O 1,2

%A _Sascha Kurz_, Nov 24 2001

%E 3 more terms from _Sean A. Irvine_, Sep 06 2009

%E Definition corrected by _David A. Corneth_, Apr 23 2016

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified February 27 12:22 EST 2020. Contains 332306 sequences. (Running on oeis4.)