login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
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). 11

%I #37 Jul 02 2024 14:50:39

%S 1,2,4,8,21,60,269,1147,4250,17883,71966,342060,1724337,8428101,

%T 37186164,175845403

%N 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 a(2)=2 because 15 and 51 (written in base 6) are primes (11 and 31).

%p A065847 := proc(n)

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

%p b :=6 ;

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

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

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

%t Length[Select[Permutations[x],

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

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

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

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

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

%o (Python)

%o from sympy import isprime

%o from sympy.utilities.iterables import multiset_permutations

%o from itertools import combinations_with_replacement

%o def A065847(n):

%o 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 Cf. A065843, A065844, A065845, A065846, A065848, A065849, A065850, A065851, A065852, A065853.

%K base,more,nonn

%O 1,2

%A _Sascha Kurz_, Nov 24 2001

%E a(12)-a(13) from _Sean A. Irvine_, Sep 06 2009

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

%E a(14) from _Chai Wah Wu_, Jun 15 2019

%E a(15) from _Michael S. Branicky_, Jun 25 2024

%E a(16) from _Michael S. Branicky_, Jul 02 2024

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified September 8 10:21 EDT 2024. Contains 375753 sequences. (Running on oeis4.)