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.

Showing 1-10 of 10 results.

A065851 Let u be any string of n digits from {0,...,9}; 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).

Original entry on oeis.org

1, 2, 4, 11, 39, 148, 731, 4333, 26519, 152526, 1251724, 7627713, 49545041, 342729012
Offset: 1

Views

Author

Sascha Kurz, Nov 24 2001

Keywords

Comments

From David A. Corneth, Jan 25 2022: (Start)
a(12) >= 7627713. a(13) >= 49545041.
There are A006879(12) = 33489857205 primes with 12 digits. There are 2.4*10^11 numbers with 12 digits that are coprime to 30 (i.e. end in 1, 3, 7, 9 and have a digital sum not divisible by 3).
On average one in 2.4*10^11/33489857205 ~= 7.166 of these numbers with 12 digits is prime.
Let maxqprimes(d) be the number of permutations of digits of d without leading 0 and ending in 1, 3, 7 or 9.
Let qprimes(d) be the number of permutations of digits of d (without leading 0 and ending in 1, 3, 7 or 9) that are prime.
a(12) = 7627713 if for some number with 12 digits we have maxprimes(d)/qprimes(d) < 5 (found via a brute force check). This is much less than the expected 7.166.
(At least) 101233456789 with 12 digits has maxqprimes(101233456789) = 54432000. This d = 101233456789 has a shared record for largest value for maxqprimes(d), along with d in {101234567789, 101234567899, 102334567789, 102345677899}. This gives maxqprimes(101233456789)/qprimes(101233456789) ~= 7.136, close to the expected 7.166.
The values d that have maxqprimes(d) >= 5*7627713 all have maxqprimes(d)/qprimes(d) >= 7.13.
For a(12) there are 2.4*10^11 checks needed if we do not use the found bound of 7627713. If we do we can bring down the search space by a factor of about 4 (without any heuristic). If we increase to 7*7627713 we only have about 9*10^8 needed checks left to do. (End)

Examples

			a(2) = 2 because 13 and 31 are primes.
a(3) = 4 because {149, 419, 491, 941} or {179, 197, 719, 971} or {379, 397, 739, 937} are primes. - _R. J. Mathar_, Apr 23 2016
		

Crossrefs

Programs

  • C
    /* See links. */
  • Mathematica
    c[x_] := Module[{},
       Length[Select[Permutations[x],
         First[#] != 0 && PrimeQ[FromDigits[#, 10]] &]]];
    A065851[n_] := Module[{i},
       Return[Max[Map[c, DeleteDuplicatesBy[Tuples[Range[0, 9], n],
           Table[Count[#, i], {i, 0, 9}] &]]]]];
    Table[A065851[n], {n, 1, 6}] (* Robert Price, Mar 30 2019 *)
  • Python
    from sympy import isprime
    from itertools import combinations_with_replacement
    from sympy.utilities.iterables import multiset_permutations
    def a(n): return max(sum(1 for p in multiset_permutations(u) if p[0] != "0" and isprime(int("".join(p)))) for u in combinations_with_replacement("0123456789", n) if sum(int(ui) for ui in u)%3)
    print([a(n) for n in range(1, 7)]) # Michael S. Branicky, Jan 24 2022
    
  • Python
    from collections import Counter
    from gmpy2 import next_prime, digits
    def A065851(n, base=10):  # change base for A065843-A065850
        c, p = Counter(), next_prime(base**(n-1))
        while p < base**n:
            c["".join(sorted(digits(p, base)))] += 1
            p = next_prime(p)
        m = min(c.most_common(1))
        return m[1]
    print([A065851(n) for n in range(1, 8)]) # Michael S. Branicky, May 28 2024
    

Extensions

1 more term from Sean A. Irvine, Sep 06 2009
Definition corrected by David A. Corneth, Apr 23 2016
a(11) from David A. Corneth, Jan 25 2022
a(12)-a(14) from Kevin Ryde, Jul 09 2024

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

Original entry on oeis.org

0, 1, 1, 2, 2, 3, 5, 12, 11, 24, 34, 79, 105, 194, 362, 734, 1143, 2045, 3872, 7758, 13001, 23902, 45539, 90436, 159510, 296210, 563833, 1110387, 2030754, 3876871, 7333827, 14353074, 26730538, 51246344, 97529176, 190928828, 358117285, 694240090, 1324674524, 2587693929, 4903604087, 9547001123
Offset: 1

Views

Author

Sascha Kurz, Nov 24 2001

Keywords

Examples

			a(4)=2 because 1011 and 1101 in base-2 notation are primes (11 and 13) and there is no set of three or more 4-digit primes with a common number of ones.
		

Crossrefs

Programs

  • Maple
    A065843 := proc(n)
        local b,u,udgs,uperm,a;
        b :=2 ;
        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,A065843(n)) ;
    end do: # R. J. Mathar, Apr 23 2016
  • Mathematica
    c[x_] := Module[{},
       Length[Select[Permutations[x],
         First[#] != 0 && PrimeQ[FromDigits[#, 2]] &]]];
    A065843[n_] := Module[{i},
       Return[Max[Map[c, DeleteDuplicatesBy[Tuples[Range[0, 1], n],
           Table[Count[#, i], {i, 0, 1}] &]]]]];
    Table[A065843[n], {n, 1, 19}] (* Robert Price, Mar 30 2019 *)
  • PARI
    lista(n) = {my(m = matrix(n,n),c); forprime(i=2,2^n, b = binary(i); m[#b,hammingweight(b)]++);vector(n,i,vecmax(m[i,]))} \\ David A. Corneth, Apr 23 2016
    
  • Python
    from sympy import isprime
    from itertools import combinations_with_replacement as mc
    from sympy.utilities.iterables import multiset_permutations as mp
    def a(n): return n-1 if n < 3 else max(sum(1 for p in mp(c) if isprime(int("1"+"".join(p)+"1", 2))) for c in mc("01", n-2))
    print([a(n) for n in range(1, 21)]) # Michael S. Branicky, Oct 09 2022

Extensions

6 more terms from Sean A. Irvine, Sep 06 2009
a(37)-a(39) from Michael S. Branicky, May 30 2024
a(40)-a(42) from Michael S. Branicky, Jun 14 2024

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 to a base-3 number; then a(n) = max_u f(u).

Original entry on oeis.org

1, 2, 2, 4, 7, 19, 42, 102, 252, 532, 1226, 3681, 9100, 24858, 61943, 161857, 392935, 1167208, 3125539, 8879693, 23143081, 63028550, 161146767, 480399716, 1325189141, 3815350317, 10255072974
Offset: 1

Views

Author

Sascha Kurz, Nov 24 2001

Keywords

Comments

a(25) >= 1325189141 via permutations of numbers with eight 0's, nine 1's and eight 2's. If some permutation class gives a larger number of primes then it's smallest element is lexicographically larger than 1000000001111111111111222. Permutation class 1000000011111111222222222 gives fewer primes than 1325189141. - David A. Corneth, May 31 2024

Examples

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

Crossrefs

Programs

  • Maple
    A065844 := proc(n)
        local b,u,udgs,uperm,a;
        b :=3 ;
        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,A065844(n)) ;
    end do: # R. J. Mathar, Apr 23 2016
  • Mathematica
    c[x_] := Module[{},
       Length[Select[Permutations[x],
         First[#] != 0 && PrimeQ[FromDigits[#, 3]] &]]];
    A065844[n_] := Module[{i},
       Return[Max[Map[c, DeleteDuplicatesBy[Tuples[Range[0, 2], n],
           Table[Count[#, i], {i, 0, 2}] &]]]]];
    Table[A065844[n], {n, 1, 13}] (* Robert Price, Mar 30 2019 *)

Extensions

3 more terms from Sean A. Irvine, Sep 06 2009
Definition corrected by David A. Corneth, Apr 23 2016
a(23)-a(24) from Michael S. Branicky, May 30 2024
a(25) confirmed by Michael S. Branicky, Jun 03 2024
a(26) from Michael S. Branicky, Jun 08 2024
a(27) from Michael S. Branicky, Jun 23 2024

A065845 Let u be any string of n digits from {0,...,3}; let f(u) = number of distinct primes, not beginning with 0, formed by permuting the digits of u to a base-4 number; then a(n) = max_u f(u).

Original entry on oeis.org

1, 2, 3, 6, 13, 36, 96, 253, 765, 2683, 7385, 25075, 83150, 293063, 888689, 3161645, 11097301, 40328876, 129951350, 469528189, 1694632516
Offset: 1

Views

Author

Sascha Kurz, Nov 24 2001

Keywords

Examples

			a(2)=2 because 13 and 31 (written in base 4) are primes (7 and 13).
		

Crossrefs

Programs

  • Maple
    A065845 := proc(n)
        local b,u,udgs,uperm,a;
        b :=4 ;
        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,A065845(n)) ;
    end do: # R. J. Mathar, Apr 23 2016
  • Mathematica
    c[x_] := Module[{},
       Length[Select[Permutations[x],
         First[#] != 0 && PrimeQ[FromDigits[#, 4]] &]]];
    A065845[n_] := Module[{i},
       Return[Max[Map[c, DeleteDuplicatesBy[Tuples[Range[0, 3], n],
           Table[Count[#, i], {i, 0, 3}] &]]]]];
    Table[A065845[n], {n, 1, 10}] (* Robert Price, Mar 30 2019 *)

Extensions

3 more terms from Sean A. Irvine, Sep 06 2009
Definition corrected by David A. Corneth, Apr 23 2016
a(19) from Michael S. Branicky, May 29 2024
a(20)-a(21) from Michael S. Branicky, Jun 14 2024

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

Original entry on oeis.org

1, 2, 4, 7, 26, 87, 226, 800, 2424, 9975, 40045, 152852, 626232, 2317403, 9962949, 43599477, 179247754, 777881238
Offset: 1

Views

Author

Sascha Kurz, Nov 24 2001

Keywords

Examples

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

Crossrefs

Programs

  • Maple
    A065846 := proc(n)
        local b,u,udgs,uperm,a;
        b :=5 ;
        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,A065846(n)) ;
    end do: # R. J. Mathar, Apr 23 2016
  • Mathematica
    c[x_] := Module[{},
       Length[Select[Permutations[x],
         First[#] != 0 && PrimeQ[FromDigits[#, 5]] &]]];
    A065846[n_] := Module[{i},
       Return[Max[Map[c, DeleteDuplicatesBy[Tuples[Range[0, 4], n],
           Table[Count[#, i], {i, 0, 4}] &]]]]];
    Table[A065846[n], {n, 1, 9}] (* Robert Price, Mar 30 2019 *)

Extensions

2 more terms from Sean A. Irvine, Sep 06 2009
Definition corrected by David A. Corneth, Apr 23 2016
a(16) from Michael S. Branicky, May 29 2024
a(17) from Michael S. Branicky, Jun 26 2024
a(18) from Michael S. Branicky, Jul 08 2024

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

Original entry on oeis.org

1, 2, 4, 8, 21, 60, 269, 1147, 4250, 17883, 71966, 342060, 1724337, 8428101, 37186164, 175845403
Offset: 1

Views

Author

Sascha Kurz, Nov 24 2001

Keywords

Examples

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

Crossrefs

Programs

  • 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 *)
  • 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

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
a(15) from Michael S. Branicky, Jun 25 2024
a(16) from Michael S. Branicky, Jul 02 2024

A065848 Let u be any string of n digits from {0,...,6}; let f(u) = number of distinct primes, not beginning with 0, formed by permuting the digits of u to a base-7 number; then a(n) = max_u f(u).

Original entry on oeis.org

1, 2, 5, 15, 45, 154, 674, 3575, 14946, 68308, 345653, 1931846, 9776107, 51415223, 311415054
Offset: 1

Views

Author

Sascha Kurz, Nov 24 2001

Keywords

Examples

			a(2)=2 because 14 and 41 (written in base 7) are primes (11 and 29).
a(3)=5 because 124, 142, 214, 241 and 421 (in base 7) are primes (67, 79, 109, 127 and 211). - _R. J. Mathar_, Apr 23 2016
		

Crossrefs

Programs

  • Mathematica
    c[x_] := Module[{},
       Length[Select[Permutations[x],
         First[#] != 0 && PrimeQ[FromDigits[#, 7]] &]]];
    A065848[n_] := Module[{i},
       Return[Max[Map[c, DeleteDuplicatesBy[Tuples[Range[0, 6], n],
           Table[Count[#, i], {i, 0, 6}] &]]]]];
    Table[A065848[n], {n, 1, 7}] (* Robert Price, Mar 30 2019 *)

Extensions

2 more terms from Sean A. Irvine, Sep 06 2009
Definition corrected by David A. Corneth, Apr 23 2016
a(13) from Michael S. Branicky, May 28 2024
a(14) from Michael S. Branicky, Jun 25 2024
a(15) from Michael S. Branicky, Jul 08 2024

A065849 Let u be any string of n digits from {0,...,7}; let f(u) = number of distinct primes, not beginning with 0, formed by permuting the digits of u to a base-8 number; then a(n) = max_u f(u).

Original entry on oeis.org

1, 2, 3, 11, 23, 113, 425, 1912, 11872, 57918, 303157, 1757094, 9777949, 59129172
Offset: 1

Views

Author

Sascha Kurz, Nov 24 2001

Keywords

Examples

			a(2)=2 because 15 and 51 (written in base 8) are primes (13 and 41).
a(3)=3 because 531, 351 and 513 (in base 8) are primes (107, 233, 331), or 145, 415 and 541 (in base 8) are primes (101, 269, 353), or 147, 417 and 471 are primes (103, 271, 313) etc. - _R. J. Mathar_, Apr 23 2016
		

Crossrefs

Programs

  • Mathematica
    c[x_] := Module[{},
       Length[Select[Permutations[x],
         First[#] != 0 && PrimeQ[FromDigits[#, 8]] &]]];
    A065849[n_] := Module[{i},
       Return[Max[Map[c, DeleteDuplicatesBy[Tuples[Range[0, 7], n],
           Table[Count[#, i], {i, 0, 7}] &]]]]];
    Table[A065849[n], {n, 1, 7}] (* Robert Price, Mar 30 2019 *)

Extensions

2 more terms from Sean A. Irvine, Sep 06 2009
Definition corrected by David A. Corneth, Apr 23 2016
a(13) from Michael S. Branicky, Jul 08 2024
a(14) from Michael S. Branicky, Jul 22 2024

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

Original entry on oeis.org

1, 2, 3, 4, 4, 5, 3, 5, 4, 6, 4, 6, 4, 5, 5, 5, 4, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 6, 6, 6, 6, 5, 6, 6, 6, 5, 6, 6, 6, 6, 5, 5, 6, 6, 6, 6, 6, 5, 6, 6, 6, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 6, 6, 6, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6
Offset: 2

Views

Author

Sascha Kurz, Nov 24 2001

Keywords

Comments

a(n) = 6 for 73 <= n < 985, except a(192) = 5.

Examples

			a(2)=1 because 101 is prime and there are no two 3-digit primes with the same number of ones in base two.
		

Crossrefs

Programs

  • Mathematica
    c[x_, n_] :=
      Module[{},
       Length[Select[Permutations[x],
         First[#] != 0 && PrimeQ[FromDigits[#, n]] &]]];
    A065852[n_] := Module[{i},
       Return[ Max[Map[c[#, n] &, DeleteDuplicatesBy[Tuples[Range[0, n - 1], 3], Table[Count[#, i], {i, 0, n - 1}] &]]]]];
    Table[A065852[n], {n, 2, 30}] (* Robert Price, Mar 30 2019 *)

Extensions

Definition corrected by David A. Corneth, Apr 23 2016

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

Original entry on oeis.org

2, 4, 6, 7, 8, 15, 11, 11, 11, 15, 15, 19, 11, 14, 15, 14, 11, 16, 13, 18, 14, 14, 14, 16, 13, 16, 15, 17, 13, 16, 14, 15, 17, 16, 15, 16, 14, 17, 14, 17, 16, 17, 14, 16, 15, 15, 14, 17, 17, 16, 16, 16, 15, 18, 16, 17, 14, 15, 14, 16, 15, 15, 16, 16, 17, 17, 13, 17, 15, 17, 13
Offset: 2

Views

Author

Sascha Kurz, Nov 24 2001

Keywords

Examples

			a(2)=2 because 1101 and 1011 are primes and there are no three 4-digit primes with the same number of ones in base 2.
		

Crossrefs

Programs

  • Mathematica
    c[x_, n_] :=
      Module[{},
       Length[Select[Permutations[x],
         First[#] != 0 && PrimeQ[FromDigits[#, n]] &]]];
    A065853[n_] := Module[{i},
       Return[ Max[Map[c[#, n] &,
          DeleteDuplicatesBy[Tuples[Range[0, n - 1], 4],
           Table[Count[#, i], {i, 0, n - 1}] &]]]]];
    Table[A065853[n], {n, 2, 20}] (* Robert Price, Mar 30 2019 *)

Extensions

Definition corrected by David A. Corneth, Apr 23 2016
Showing 1-10 of 10 results.