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!)
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; then a(n) = max_u f(u). 10
1, 2, 4, 8, 21, 60, 269, 1147, 4250, 17883, 71966, 342060, 1724337, 8428101 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,2

LINKS

Table of n, a(n) for n=1..14.

EXAMPLE

a(2)=2 because 15 and 51 (written in base 6) are primes (11 and 31).

MAPLE

A065847 := proc(n)

    local b, u, udgs, uperm, a;

    b :=6 ;

    a := 0 ;

    for u from b^(n-1) to b^n-1 do

        udgs := convert(u, base, b) ;

        prs := {} ;

        for uperm in combinat[permute](udgs) do

            if op(-1, uperm) <> 0 then

                p := add( op(i, uperm)*b^(i-1), i=1..nops(uperm)) ;

                if isprime(p) then

                    prs := prs union {p} ;

                end if;

            end if;

        end do:

        a := max(a, nops(prs)) ;

    end do:

    a ;

end proc:

for n from 1 do

    print(n, A065847(n)) ;

end do: # R. J. Mathar, Apr 23 2016

MATHEMATICA

c[x_] := Module[{},

   Length[Select[Permutations[x],

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

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

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

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

Table[A065847[n], {n, 1, 8}] (* Robert Price, Mar 30 2019 *)

PROG

(Python)

from sympy import isprime

from sympy.utilities.iterables import multiset_permutations

from itertools import combinations_with_replacement

def A065847(n):

    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

CROSSREFS

Cf. A065843, A065844, A065845, A065846, A065848, A065849, A065850, A065851, A065852, A065853

Sequence in context: A162110 A108071 A055876 * A133604 A262345 A192149

Adjacent sequences:  A065844 A065845 A065846 * A065848 A065849 A065850

KEYWORD

base,more,nonn

AUTHOR

Sascha Kurz, Nov 24 2001

EXTENSIONS

a(12)-a(13) from Sean A. Irvine, Sep 06 2009

Definition corrected by David A. Corneth, Apr 23 2016

a(14) from Chai Wah Wu, Jun 15 2019

STATUS

approved

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 January 24 13:24 EST 2020. Contains 331193 sequences. (Running on oeis4.)