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.

Previous Showing 11-20 of 50 results. Next

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

A158577 a(n) = size of the n-th term in S(10) (defined in Comments).

Original entry on oeis.org

4, 21, 143, 1061, 8363, 68900, 1, 1, 1, 1, 1, 1, 586044, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5096511, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
Offset: 1

Views

Author

W. Edwin Clark, Mar 21 2009

Keywords

Comments

Let H(L,b) be the Hamming graph whose vertices are the sequences of length L over the alphabet {0,1,...,b-1} with adjacency being defined by having Hamming distance 1. Let P(L,b) be the subgraph of H(L,b) induced by the set of vertices which are base b representations of primes with L digits (not allowing leading 0 digits). Let S(b) be the sequence of all components of the graphs P(L,b), L>0, sorted by the smallest prime in a component.
Next terms not equal 1: a(416) = 45082721 and a(3771) = 404171351 (see b-file). - Max Alekseyev, Dec 23 2024

Crossrefs

Cf. A006879, A158576, A158578, A158579 (base 10).
Cf. A145667, A145668, A145669, A145670 (base 2).
Cf. A145671, A145672, A145673, A145674 (base 3).

Extensions

Terms a(51) onward from Max Alekseyev, Dec 23 2024

A130817 a(n) is the total sum of the digits of n-digit primes.

Original entry on oeis.org

17, 197, 2041, 19879, 195226, 1920513, 18980518, 188098738, 1867197599, 18562452601, 184727304713, 1839816627645, 18335212785129, 182813489520604
Offset: 1

Views

Author

Tanya Khovanova, Jul 16 2007

Keywords

Crossrefs

Cf. A006879.

Programs

  • Mathematica
    Table[Plus @@ Flatten[IntegerDigits[Select[Range[10^(n - 1), 10^n], PrimeQ[ # ] &]]], {n, 7}]
  • PARI
    A007953(n)={ local(a=0,shft=n) ; while(shft!=0, a += shft %10 ; shft \= 10 ; ) ; return(a) ; }
    A130817(n)={ local(a=0) ; forprime(p=10^(n-1),10^n, a += A007953(p) ; ) ; return(a) ; }
    { for(n=1,30, print(A130817(n)" ") ; ) ; } \\ R. J. Mathar, Jan 16 2008

Extensions

a(8) from R. J. Mathar, Jan 16 2008
a(9)-a(11) from Jon E. Schoenfield, Dec 01 2008
a(12)-a(14) from Giovanni Resta, Jul 20 2015

A073532 Number of n-digit primes with all digits distinct.

Original entry on oeis.org

4, 20, 97, 510, 2529, 10239, 33950, 90510, 145227, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
Offset: 1

Views

Author

Zak Seidov, Aug 29 2002

Keywords

Comments

For any base b the number of distinct-digit primes is finite. For base 10, the maximal distinct-digit prime is 987654103; for any larger prime at least two digits coincide. The number of distinct-digit integers is also finite, see A073531.
No such primes exist with 10 or more distinct decimal digits, so a(n) = 0 for n >= 10. - Labos Elemer, Oct 25 2004; Robert G. Wilson v, Jul 25 2008

Examples

			a(3)=97 because there are 97 three-digit primes with distinct digits: 103, 107, 109, 127, 137, 139, 149, 157, 163, 167, 173, 179, 193, 197,239, 241, 251, 257, 263, 269, 271, 281, 283, 293,307, 317, 347, 349, 359, 367, 379, 389, 397, 401, 409, 419, 421, 431, 439, 457, 461, 463, 467, 479, 487, 491, 503, 509, 521, 523, 541, 547, 563, 569, 571, 587, 593, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 673, 683, 691, 701, 709, 719, 739, 743, 751, 761, 769, 809, 821, 823, 827, 829, 839, 853, 857, 859, 863, 907, 937, 941, 947, 953, 967, 971, 983.
		

Crossrefs

Programs

  • Mathematica
    lst = {}; Do[p = Prime@ n; If[ Union[Length /@ Split@ Sort@ IntegerDigits@ p] == {1}, AppendTo[lst, p]], {n, PrimePi[10^9]}]; Table[ Length@ Select[lst, 10^n < # < 10^(n + 1) &], {n, 0, 9}] (* Robert G. Wilson v, Jul 25 2008 *)
  • Python
    from itertools import permutations
    from sympy import isprime, primerange
    def distinct_digs(n): s = str(n); return len(s) == len(set(s))
    def a(n):
      if n >= 10: return 0
      return sum(isprime(int("".join(p))) for p in permutations("0123456789", n) if p[0] != '0')
    print([a(n) for n in range(1, 31)]) # Michael S. Branicky, Apr 20 2021

Extensions

Edited by N. J. A. Sloane, Aug 14 2007
Entries checked by Robert G. Wilson v, Jul 25 2008

A284398 Table read by rows: T(n,k) is the number of n-digit numbers that have exactly k divisors.

Original entry on oeis.org

1, 4, 2, 2, 0, 21, 2, 30, 2, 16, 1, 10, 1, 2, 0, 5, 0, 143, 7, 260, 1, 94, 1, 170, 7, 20, 0, 92, 0, 5, 4, 47, 0, 17, 0, 11, 1, 0, 0, 16, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1061, 14, 2316, 1, 654, 0, 1934, 24, 128, 1, 943, 1, 36, 11, 753, 0, 142, 0, 146, 4, 3, 0, 433
Offset: 1

Views

Author

Jon E. Schoenfield, Mar 26 2017

Keywords

Comments

Rows begin with row 1: [1, 4, 2, 2] for the nine 1-digit numbers 1..9 (of which one (1) has one divisor, four (the primes: 2, 3, 5, and 7) have two, two (2^2 = 4 and 3^2 = 9) have three, and two (2*3 = 6 and 2^3 = 8) have four).
The successive rows have lengths 4, 12, 32, 64, 128, 240, ... (A066150).

Examples

			Table begins:
row 1: 1, 4, 2, 2;
row 2: 0, 21, 2, 30, 2, 16, 1, 10, 1, 2, 0, 5;
row 3: 0, 143, 7, 260, 1, 94, 1, 170, 7, 20, 0, 92, 0, 5, 4, 47, 0, 17, 0, 11, 1, 0, 0, 16, 0, 0, 1, 1, 0, 1, 0, 1;
row 4: 0, 1061, 14, 2316, 1, 654, 0, 1934, 24, 128, 1, 943, 1, 36, 11, 753, 0, 142, 0, 146, 4, 3, 0, 433, 1, 0, 6, 29, 0, 43, 0, 129, 1, 0, 1, 80, 0, 0, 0, 36, 0, 7, 0, 0, 3, 0, 0, 45, 0, 2, 0, 0, 0, 4, 0, 2, 0, 0, 0, 4, 0, 0, 0, 2;
		

Crossrefs

Columns k=1..6 give A000007, A006879, A379566, A379567, A379568, A379569.
Length of n-th row is A066150(n).
Cf. A000005 (number of divisors).

Programs

  • Mathematica
    Table[Block[{t = KeySort[10^n - 1 + PositionIndex@ DivisorSigma[0, #] &@ Range[10^n, 10^(n + 1) - 1]]}, ReplacePart[ConstantArray[0, Max@ Keys@ t], Map[# -> Length@ Lookup[t, #] &, Keys@ t]]], {n, 0, 3}] (* Michael De Vlieger, Nov 01 2017 *)

A228111 Integer nearest to (S(n)*F(4n)(S(n))), where F(4n)(x) are Fibonacci polynomials of multiple of 4 indices (4n) and S(n) = Sum_{i=0..3} (C(i)*(log(log(A*(B+n^2))))^i) (see coefficients A, B, C(i) in comments).

Original entry on oeis.org

4, 21, 143, 1063, 8385, 68929, 584467, 5074924, 44885325, 402777151, 3656032622, 33492393634, 309106153431, 2870123507479, 26783122426197, 250971797533095, 2359952229466124, 22256979400698116, 210440626023838163, 1994088284872617955, 18931694933036811169
Offset: 1

Views

Author

Vladimir Pletser, Aug 10 2013

Keywords

Comments

Coefficients are A=16103485019141/2900449771918928, B=5262046568827901/29305205016290, C(0)=296261685121849/265642652464758, C(1)=38398556529727/750568780742436, C(2)=0, C(3)=-11594434149768/8254020049890781.
This sequence gives a good approximation of the number of primes with n digits (A006879); see (A228112).
As the squares of odd-indexed Fibonacci numbers F(2n+1)(1) (see A227693) are equal or close to the first values of pi(10^n) (A006880), and as F(4n)(1)=(F(2n+1)(1))^2- (F(2n-1)(1))^2, it is legitimate to ask whether the first values of the differences pi(10^n)- pi(10^(n-1)) (A006879) are also close or equal to multiple of 4 index Fibonacci numbers F(4n)(1); e.g., for n=2, F(8)(1)=21. However, when using Fibonacci polynomials, the exact relation is xF(4n)(x)=(F(2n+1)(x))^2- (F(2n-1)(x))^2.
To obtain this sequence, one switches to the product of x and multiple of 4 index Fibonacci polynomials F(4n)(x), and one obtains the sequence a(n) by computing x as a function of n such that (xF(4n)(x)) fit the values of pi(10^n)- pi(10^(n-1)) for 1 <= n <= 25, with pi(1)=0.

Examples

			For n=1, xF(4)(x) = x^2*(x^2+2); replace x with Sum_{i=0..3} (C(i)*(log(log(A*(B+1))))^i)= 1.11173... to obtain a(1) = round((1.11173...)*F(4)(1.11173...)) = 4.
For n=2, xF(8)(x) = x^2*(x^2+2)*(x^4+4*x^2+2); replace x with Sum_{i=0..3} (C(i)*(log(log(A*(B+4))))^i)= 0.99998788... to obtain a(2) = round((0.99998788...)*F(8)(0.99998788...)) = 21.
		

References

  • John H. Conway and R. K. Guy, The Book of Numbers, Copernicus, an imprint of Springer-Verlag, NY, 1996, page 144.

Crossrefs

Programs

  • Maple
    with(combinat):A:=16103485019141/2900449771918928: B:=5262046568827901/29305205016290: C(0):=296261685121849/265642652464758: C(1):=38398556529727/750568780742436: C(2):=0: C(3):=-11594434149768/8254020049890781: b:=n->log(log(A*(B+n^2))): c:=n->sum(C(i)*(b(n))^i, i=0..3): seq(round(c(n)*fibonacci(4*n, c(n))), n=1..25);

Formula

a(n) = round(S(n)*F(4n)(S(n))), where S(n) = Sum_{i=0..3} (C(i)*(log(log(A*(B+n^2))))^i).

A228115 First differences of A227693.

Original entry on oeis.org

3, 21, 143, 1061, 8366, 68932, 585881, 5094722, 45074595, 404185377, 3663479699, 33498077106, 308548877876, 2859703657128, 26646019345842, 249434445759050, 2344494354096166, 22116172789221197, 209301155352811190, 1986521422431963549, 18904049485198437478, 180323870540071281301, 1723847795281971132487, 16512536418951055856540, 158463448213030472998711
Offset: 1

Views

Author

Vladimir Pletser, Aug 10 2013

Keywords

Comments

This sequence gives a good approximation of the number of primes with n digits (A006879); see (A228116).

Examples

			For n =1, A227693(1)- A227693(0) =4-1=3, where A227693(1)= round((F[3]( 1.016825…))^2)=4 with F[3](x) = x^2+1 and A227693(0)= round(F[1](x)) =1 with F[1](x)=1
		

References

  • John H. Conway and R. K. Guy, The Book of Numbers, Copernicus, an imprint of Springer-Verlag, NY, 1996, page 144.

Crossrefs

Formula

a(n)= A227693(n)- A227693(n-1)

A087630 Number of n-digit primes ending in 1 in base 10.

Original entry on oeis.org

0, 5, 35, 266, 2081, 17230, 146487, 1274194, 11271088, 101050133, 915755611, 8372443850, 77114409020
Offset: 1

Views

Author

Meenakshi Srikanth (menakan_s(AT)yahoo.com) and Amarnath Murthy, Sep 15 2003

Keywords

Examples

			a(2) = 5 as there exist 5 two-digit prime numbers (11, 31, 41, 61, and 71) with units place 1.
a(3) = 35, since there are 35 three-digit numbers with units place digit as 1.
		

Crossrefs

Programs

  • Java
    /** The terms of the sequences are generated by changing the range for j for the various numbers of digits. E.g., it ranges from 100 to 999 for three-digit numbers. */
    float r, x;
    int c = 0, count = 0;
    for (float j = 100f; j < 1000f; j++) { for (float i = 2f; i < j; i++) { r = j % i; if (r == 0) c = 1; } if (c == 0) { x = j % 10; if (x == 1) count = count + 1; } c = 0; } System.out.println("count = " + count);
    
  • Mathematica
    Table[Length[Select[Range[10^n + 1, 10^(n + 1) - 9, 10], PrimeQ[#] &]], {n, 5}] (* Alonso del Arte, Apr 27 2014 *)
  • PARI
    a(n) = my(c=0); forprime(p=10^(n-1), 10^n, if(p%10==1, c++)); c \\ Iain Fox, Aug 07 2018

Formula

From Iain Fox, Aug 07 2018: (Start)
a(n) ~ (1/4) * Integral_{x=10^(n-1)..10^n} (dx/log(x)).
a(n) = A006879(n) - A087631(n) - A087632(n) - A087633(n), for n > 1.
(End)

Extensions

More terms from Ray Chandler, Oct 04 2003
Offset corrected by Iain Fox, Aug 07 2018
a(11) from Iain Fox, Aug 07 2018
a(12)-a(13) from Giovanni Resta, Aug 07 2018

A098224 Number of primes <=10^n in which decimal digits are all distinct.

Original entry on oeis.org

4, 24, 121, 631, 3160, 13399, 47349, 137859, 283086, 283086, 283086, 283086, 283086, 283086, 283086, 283086, 283086, 283086, 283086, 283086, 283086, 283086, 283086, 283086, 283086, 283086, 283086, 283086, 283086, 283086, 283086, 283086, 283086, 283086, 283086
Offset: 1

Views

Author

Labos Elemer, Oct 26 2004

Keywords

Comments

Partial sums of A073532. - Lekraj Beedassy, Aug 02 2008
No number with more than 10 digits can have all of its decimal digits distinct, and no number that uses all ten distinct decimal digits can be prime (because the sum of all ten decimal digits is 45 so any such number is divisible by 3). Therefore, every term in the sequence from and after a(9) is the same, i.e., 283086. - Harvey P. Dale, Dec 12 2010

Crossrefs

Programs

  • Mathematica
    okQ[n_]:=Max[DigitCount[n]]==1
    Table[Length[Select[Prime[Range[PrimePi[10^i]]],okQ]],{i,9}] (* Harvey P. Dale, Dec 12 2010 *)
  • Python
    from sympy import sieve
    def distinct_digs(n): s = str(n); return len(s) == len(set(s))
    def aupton(terms):
      ps, alst = 0, []
      for n in range(1, terms+1):
        if n >= 10: alst.append(ps); continue
        ps += sum(distinct_digs(p) for p in sieve.primerange(10**(n-1), 10**n))
        alst.append(ps)
      return alst
    print(aupton(35)) # Michael S. Branicky, Apr 24 2021

Formula

a(n) = 283086 for n >= 9.

A098227 Number of primes with exactly n decimal digits which have repeated digits.

Original entry on oeis.org

0, 1, 46, 551, 5834, 58667, 552131, 5006366, 44940852, 404204977, 3663002302, 33489857205, 308457624821, 2858876213963, 26639628671867, 249393770611256, 2344318816620308, 22116397130086627, 209317712988603747
Offset: 1

Views

Author

Labos Elemer, Oct 25 2004

Keywords

Comments

Above n = 9, a(n) = A006879(n) because above 10 there must be repeated digits. At n = 10 the sum of digits 0+1+2+3+4+5+6+7+8+9=45 is divisible by 3, so no primes with 10 distinct decimal digits exist, all primes must have repeated digits.

Examples

			Above n = 9 a(n) = A006879(n) because above 10 there must be a repetition. At n = 10 the sum of digits 0+1+2+3+4+5+6+7+8+9=45 is divisible by 3, so no primes with 10 distinct decimal digits exist.
		

Crossrefs

Programs

  • Mathematica
    Table[Count[Prime@ Range[If[# == 0, 1, # + 1] &@ PrimePi[10^n], PrimePi[10^(n + 1) - 1]], p_ /; Total@ Boole@ Map[# > 1 &, DigitCount@ p] > 0], {n, 0, 6}] (* Michael De Vlieger, Mar 26 2017 *)
Previous Showing 11-20 of 50 results. Next