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 46 results. Next

A339978 a(n) is the largest prime whose decimal expansion consists of the concatenation of a 1-digit square, a 2-digit square, a 3-digit square, ..., and an n-digit square, or 0 if there is no such prime.

Original entry on oeis.org

0, 449, 981961, 9819619801, 981961980196721, 981961980199856194481, 9819619801998569980018946081, 981961980199856998001999824499740169, 981961980199856998001999824499980001989039601, 9819619801998569980019998244999800019999508849977812321
Offset: 1

Views

Author

Bernard Schott, Dec 25 2020

Keywords

Comments

If a(n) exists it has A000217(n)= n*(n+1)/2 digits.
All the terms end with 1 or 9.

Examples

			a(1) = 0 because no 1-digit square {0, 1, 4, 9} is prime.
a(2) = 449 because 464, 481, 916, 925, 936, 949, 964, and 981 are not primes and 449, concatenation of 4 = 2^2 with 49 = 7^2, is prime.
a(4) = 9819619801, which is a prime is the concatenation of 9 = 3^2 with 81 = 9^2, then 961 = 31^2 and 9801 = 99^2. Observation, 9, 81, 961 and 9801 are the largest squares with respectively 1, 2, 3 and 4 digits.
		

Crossrefs

Cf. A000290, A003618, A061433 (largest squares), A338968 (concatenate primes).

Programs

  • Python
    from sympy import isprime
    from itertools import product
    def a(n):
      squares = [str(k*k) for k in range(1, int((10**n)**.5)+2)]
      revsqrs = [[kk for kk in squares if len(kk)==i+1][::-1] for i in range(n)]
      for t in product(*revsqrs):
        intt = int("".join(t))
        if isprime(intt): return intt
      return 0
    print([a(n) for n in range(1, 11)]) # Michael S. Branicky, Dec 25 2020

Extensions

a(5)-a(10) from Michael S. Branicky, Dec 25 2020

A338968 a(n) is the largest prime whose decimal expansion consists of the concatenation of a 1-digit prime, a 2-digit prime, a 3-digit prime, ..., and an n-digit prime.

Original entry on oeis.org

7, 797, 797977, 7979979941, 797997997399817, 797997997399991999371, 7979979973999919999839999901, 797997997399991999983999999199999131, 797997997399991999983999999199999989999997639, 7979979973999919999839999991999999899999999379999997871
Offset: 1

Views

Author

Bernard Schott, Dec 21 2020

Keywords

Comments

It is a plausible conjecture that a(n) always exists and begins with 7.
The similar smallest primes are in A215641.
If a(n) exists, it has A000217(n) = n*(n+1)/2 digits.
a(1) = 7 = A003618(1) and a(2) = 797 is the concatenation of 7 = A003618(1) and 97 = A003618(2) that are respectively the largest 1-digit prime and 2-digit prime.
Conjecture: for n >= 3, a(n) is the concatenation of the largest k-digit primes with 1 <= k <= n-1: A003618(1)/A003618(2)/.../A003618(n-1) but the last concatenated prime with n digits is always < A003618(n). This conjecture has been checked by Daniel Suteu until a(360), a prime with 64980 digits.

Examples

			a(3) = 797977 is the largest prime formed from the concatenation of a single-digit, a double-digit, a triple-digit prime, i.e., 7, 97, 977.
a(4) = 7979979941 is the largest prime formed from the concatenation of a single-digit, a double-digit, a triple-digit, and a quadruple-digit prime, i.e., 7, 97, 997, 9941.
		

Crossrefs

Subsequence of A195302.
Cf. A339978 (with concatenated squares), A340115 (with concatenated cubes).

Extensions

More terms from David A. Corneth, Dec 21 2020

A132153 Largest prime <= square root of 10^n.

Original entry on oeis.org

3, 7, 31, 97, 313, 997, 3137, 9973, 31607, 99991, 316223, 999983, 3162277, 9999991, 31622743, 99999989, 316227731, 999999937, 3162277633, 9999999967, 31622776589, 99999999977, 316227766003, 999999999989, 3162277660153, 9999999999971, 31622776601657
Offset: 1

Views

Author

Anthony C Robin, Nov 01 2007

Keywords

Comments

To check if an (n+1)-digit number is prime, a(n) is the largest prime which one needs to check is not a factor of the (n+1)-th digit number. For example, to check that a general four-digit number is not prime, we need to test its divisibility by all the primes up to and including 97.

Crossrefs

Programs

  • Mathematica
    Table[NextPrime[Sqrt[10^n],-1],{n,27}] (* James C. McMahon, Mar 04 2025 *)
  • PARI
    a(n)=precprime(sqrtint(10^n)) \\ Charles R Greathouse IV, Aug 18 2011
    
  • Python
    from sympy import prevprime, integer_nthroot
    def a(n): return prevprime(integer_nthroot(10**n, 2)[0]+1)
    print([a(n) for n in range(1, 28)]) # Michael S. Branicky, Dec 23 2021

Formula

a(n) = A000040(A122121(n)). a(2n) = A003618(n). - R. J. Mathar, Nov 06 2007 [Corrected by Jaroslav Krizek, Jul 12 2010]
a(n) = sqrt(A175734(n)). - Jaroslav Krizek, Aug 24 2010

Extensions

More terms from N. J. A. Sloane, Jan 05 2008

A098450 Largest n-digit semiprime.

Original entry on oeis.org

9, 95, 998, 9998, 99998, 999997, 9999998, 99999997, 999999991, 9999999997, 99999999997, 999999999997, 9999999999989, 99999999999997, 999999999999998, 9999999999999994, 99999999999999989, 999999999999999993, 9999999999999999991, 99999999999999999983
Offset: 1

Views

Author

Rick L. Shepherd, Sep 07 2004

Keywords

Crossrefs

Cf. A098449 (smallest n-digit semiprime), A003618 (largest n-digit prime), A001358 (semiprimes), A119320.

Programs

  • Mathematica
    NextSemiPrime[n_, k_: 1] := Block[{c = 0, sgn = Sign[k]}, sp = n + sgn; While[c < Abs[k], While[ PrimeOmega[sp] != 2, If[sgn < 0, sp--, sp++]]; If[sgn < 0, sp--, sp++]; c++]; sp + If[sgn < 0, 1, -1]]; f[n_] := NextSemiPrime[10^n, -1]; Array[f, 18] (* Robert G. Wilson v, Dec 18 2012 *)
  • PARI
    apply( A098450(n)={n=10^n;until(bigomega(n-=1)==2,);n}, [1..20]) \\ M. F. Hasler, Jan 01 2021
    
  • Python
    from sympy import factorint
    def semiprime(n): f = factorint(n); return sum(f[p] for p in f) == 2
    def a(n):
      an = 10**n - 1
      while not semiprime(an): an -= 1
      return an
    print([a(n) for n in range(1, 21)]) # Michael S. Branicky, Apr 10 2021

Formula

a(n) = 10^n - A119320(n). - Amiram Eldar, Sep 18 2021

A342443 a(n) is the largest prime < 10^n that is the sum of at least two consecutive primes.

Original entry on oeis.org

5, 97, 991, 9949, 99971, 999983, 9999991, 99999989, 999999937, 9999999943, 99999999977, 999999999989, 9999999999763, 99999999999959, 999999999999989
Offset: 1

Views

Author

Bernard Schott, Mar 12 2021

Keywords

Comments

The minimum corresponding number of consecutive primes to get this largest prime a(n) is A342444(n) and the first prime of these A342444(n) consecutive primes is A342454(n).
Differs from A342439 where the corresponding primes result of the longest sum < 10^n of consecutive primes.
a(n) is the largest n-digit prime A003618(n) for n = 2, 6, 7, 8, 9, 11, 12, ...
a(13) >= k = 10^13 - 237. If a(13) > k then it is the sum of at least 30000 primes. k can be written as the sum of 6449 consecutive primes. - David A. Corneth, Mar 13 2021
No sum of 30000 or more consecutive primes is in the interval [10^13 - 237, 10^13 - 1], so a(13) = 10^13 - 237. - Jon E. Schoenfield, Mar 14 2021

Examples

			a(1) = 5 = 2 + 3, since it is not possible to obtain the greatest 1-digit prime 7 when adding consecutive primes.
a(2) = 29 + 31 + 37 = 97, since (29, 31, 37) are consecutive primes and 97 is the largest 2-digit prime.
		

Crossrefs

Formula

A342439(n) <= a(n) <= A003618(n).

Extensions

a(9) from Jinyuan Wang, Mar 13 2021
a(10) from David A. Corneth, Mar 13 2021
a(11)-a(12) from Jinyuan Wang, Mar 13 2021
a(13)-a(14) from Jon E. Schoenfield, Mar 13 2021
a(15) from Max Alekseyev, Dec 11 2024

A104089 Largest prime <= 4^n.

Original entry on oeis.org

3, 13, 61, 251, 1021, 4093, 16381, 65521, 262139, 1048573, 4194301, 16777213, 67108859, 268435399, 1073741789, 4294967291, 17179869143, 68719476731, 274877906899, 1099511627689, 4398046511093, 17592186044399, 70368744177643
Offset: 1

Views

Author

Cino Hilliard, Mar 03 2005

Keywords

Crossrefs

Programs

  • Mathematica
    NextPrime[4^Range[30], -1] (* Paolo Xausa, Oct 28 2024 *)
  • PARI
    g(n,b) = for(x=0,n,print1(precprime(b^x)","))

Formula

a(n) = A007917(A000302(n)). - Paolo Xausa, Oct 28 2024

A104090 Largest prime <= 5^n.

Original entry on oeis.org

5, 23, 113, 619, 3121, 15619, 78121, 390581, 1953109, 9765619, 48828113, 244140613, 1220703073, 6103515623, 30517578121, 152587890563, 762939453109, 3814697265523, 19073486328109, 95367431640599, 476837158203071, 2384185791015571, 11920928955078089
Offset: 1

Views

Author

Cino Hilliard, Mar 03 2005

Keywords

Crossrefs

Programs

  • Mathematica
    NextPrime[5^Range[30] + 1, -1] (* Paolo Xausa, Oct 29 2024 *)
  • PARI
    g(n,b) = for(x=0,n,print1(precprime(b^x)","))

Formula

a(n) = A007917(A000351(n)). - Paolo Xausa, Oct 29 2024

A178007 Largest n-digit prime with the most digits equal to 9.

Original entry on oeis.org

7, 97, 997, 9949, 99991, 999979, 9999991, 99999989, 999999929, 9999999929, 99999999599, 999999999989, 9999999999799, 99999999999959, 999999999999989, 9999999999999199, 99999999999999997, 999999999999999989, 9999999999999999919, 99999999999999999989, 999999999999999999899, 9999999999999999999929
Offset: 1

Views

Author

Lekraj Beedassy, May 17 2010

Keywords

Comments

First maximum the number of 9's, then choose the largest.
From Robert Israel, Dec 18 2024: (Start)
This is believed to be different from A241206, as there should be infinitely many n for which there is no n-digit prime with n-1 digits equal to 9. No examples are known; the least such n is greater than 3400. (End)

Crossrefs

Programs

  • Maple
    f:= proc(n) local i,j,a,b,x,y;
         x:= 10^n-1;
         for i from 0 to n-1 do
           for a from 1 to 9 do
             y:= x - a*10^i;
             if isprime(y) then return y fi;
         od od;
         for i from 1 to n-1 do
           for a from 1 to 9 do
             for j from 0 to i-1 do
               for b from 1 to 9 do
                 y:= x - a*10^i - b*10^j;
                 if isprime(y) then return y fi
        od od od od;
        FAIL
    end proc:
    map(f, [$1..30]); # Robert Israel, Dec 16 2024

Extensions

Corrected and more terms by Robert Israel, Dec 16 2024

A228629 Members p of a pair of primes (p,q) such that the decimal digits of q are the 9's complement of the decimal digits of p.

Original entry on oeis.org

2, 7, 23, 61, 67, 83, 107, 109, 127, 163, 167, 181, 211, 223, 227, 239, 241, 251, 263, 269, 271, 277, 283, 293, 307, 367, 383, 389, 401, 409, 421, 461, 463, 467, 487, 509, 521, 523, 563, 587, 601, 607, 613, 617, 631, 641, 643, 647, 653, 661, 673, 677, 683, 701
Offset: 1

Views

Author

Michel Lagneau, Aug 28 2013

Keywords

Comments

We consider length(p) = length(q). For example, the primes p = 97, 997, 99999999999999997,...(see A003618) are not in the sequence with q = 2.
Each prime p appears only once in the sequence, but the pair (p, q) is not unique, for example the prime 163 generates two pairs of primes(163, 683) and (163, 863), the prime 283 generates three pairs of primes(283, 167), (283, 617) and (283, 761).
The couples of primes (p, q) are (2, 7), (7, 2), (23, 67), (61, 83), (67, 23), (83, 61), (107, 829), (109, 809), (127, 827),...
In the general case, the digits of p are different from q, but there exists numbers p such that q has the same digits as p, for example (p, q) = (227, 277), (727, 227), (881, 181), ...

Examples

			23 is in the sequence because 9-2 = 7 and 9 - 3 = 6 => 67 is prime, and we obtain the pair (23, 67).
		

Crossrefs

Cf. A228628.

Programs

  • Maple
    with(numtheory):kk:=0:
        for n from 1 to 200 do:
          ii:=0:
            for k from 1 to 2000 while(ii=0) do:
            p1:=ithprime(n):p2:=ithprime(k):
            x1:=convert(p1,base,10):n1:=nops(x1):
            x2:=convert(p2,base,10):n2:=nops(x2):
             if n1=n2 then
             W:=array(1..n1):U:=array(1..n1):U1:=array(1..n1):
               for c from 1 to n1 do:
               U1[c]:=x1[c]:od:U:=sort(x1,`<`):V:=sort(x2,`>`):
                 for j from 1 to n1 do:
                 W[j]:= 9-V[j]:od:W1:=sort(W,`>`):jj:=0:
                   for b from 1 to n1 do:
                     if U[b]=W1[b] then
                     jj:=jj+1:
                     else fi:
                   od:
                     if jj=n1 then
                      ii:=1: kk:=kk+1: printf(`%d, `,p1):
                      else
                     fi:
               fi:
            od:
           od:
    # Alternative:
    R:= 2,7:
    for d from 2 to 3 do
      P:= select(isprime,[seq(i,i=10^(d-1)+1..10^d-1,2)]);
      nP:= nops(P);
      Pd:= map(sort@convert,P,base,10);
      Ps:= convert(map(t -> ListTools:-Reverse([9$d]-t), Pd),set);
      S:= select(t -> member(Pd[t],Ps),[$1..nP]);
      R:= R, op(P[S]);
    od:
    R; # Robert Israel, Oct 06 2020

A249448 Largest n-digit prime whose digit sum is also prime.

Original entry on oeis.org

7, 89, 991, 9967, 99991, 999983, 9999971, 99999989, 999999937, 9999999943, 99999999821, 999999999989, 9999999999971, 99999999999923, 999999999999883, 9999999999999851, 99999999999999997, 999999999999999967, 9999999999999999919, 99999999999999999989, 999999999999999999829
Offset: 1

Views

Author

Paolo P. Lava, Oct 29 2014

Keywords

Comments

Subsequence of A046704 (primes with digit sum being prime).
Some terms of this sequence are also in A003618, the largest n-digit primes.

Examples

			a(1) = 7 because it is the largest prime with just one digit.
a(2) = 89 because it is the largest prime with 2 digits whose sum, 8 + 9 = 17, is a prime.
Again, a(7) = 9999971 because it is the largest prime with 7 digits whose sum is a prime: 9 + 9 + 9 + 9 + 9 + 7 + 1 = 53.
		

Crossrefs

Programs

  • Maple
    P:=proc(q) local a,b,k,n; for k from 0 to q do
    for n from 10^(k+1)-1 by -1 to 10^k do if isprime(n) then a:=n; b:=0;
    while a>0 do b:=b+(a mod 10); a:=trunc(a/10); od;
    if isprime(b) then print(n); break; fi; fi;
    od; od; end: P(10^3);
  • Mathematica
    Table[Module[{p=NextPrime[10^n,-1]},While[!PrimeQ[Total[IntegerDigits[p]]],p=NextPrime[p,-1]];p],{n,25}] (* Harvey P. Dale, Jun 20 2023 *)
  • PARI
    a(n) = {p = precprime(10^n); while (!isprime(sumdigits(p)), p = precprime(p-1)); p;} \\ Michel Marcus, Oct 29 2014
Previous Showing 11-20 of 46 results. Next