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 21-30 of 58 results. Next

A376907 a(n) is the least n-digit cuban prime.

Original entry on oeis.org

7, 19, 127, 1657, 10267, 102121, 1021417, 10052191, 100381321, 1000556719, 10000510297, 100025541019, 1000011191887, 10000028937841, 100000062634561, 1000001305386991, 10000001240507791, 100000021541868691, 1000000084213608427, 10000000012591553221, 100000000159478313337
Offset: 1

Views

Author

Stefano Spezia, Oct 08 2024

Keywords

Comments

a(n) - A011557(n-1) is a multiple of 3.

Crossrefs

Programs

  • Maple
    nextcuban:= proc(n)
      local k,y;
      for k from ceil((sqrt(12*n-3)-3)/6) do
        y:= (k+1)^3 - k^3;
        if isprime(y) then return y fi
      od
    end proc:
    seq(nextcuban(10^i), i = 0 .. 25); # Robert Israel, Nov 08 2024
  • Mathematica
    a[n_]:=Module[{k=1},While[!PrimeQ[m=3k^2+3k+1]||IntegerLength[m]
    				
  • Python
    from itertools import count
    from math import isqrt
    from sympy import isprime
    def A376907(n):
        for k in count(isqrt((((a:=10**(n-1))<<2)-1)//12)):
            m = 3*k*(k+1)+1
            if m >= a and isprime(m):
                return m # Chai Wah Wu, Oct 13 2024

Formula

Conjecture: a(n+1)/a(n) ~ 10.

A099667 a(n) is the largest prime before A002281(n); repdigits repeating 7.

Original entry on oeis.org

5, 73, 773, 7759, 77773, 777769, 7777769, 77777761, 777777773, 7777777741, 77777777767, 777777777773, 7777777777771, 77777777777753, 777777777777773, 7777777777777753, 77777777777777747, 777777777777777743
Offset: 1

Views

Author

Labos Elemer, Nov 17 2004

Keywords

Examples

			n=2: 73 is before 77.
		

Crossrefs

Programs

  • Mathematica
    Table[NextPrime[7 (10^n - 1)/9, -1], {n, 35}]
    (* Second program: *)
    Rest[NextPrime[#,-1]&/@LinearRecurrence[{11,-10},{0,7},25]] (* Harvey P. Dale, May 24 2015 *)

Extensions

Name changed by David A. Corneth, Sep 01 2017

A115062 Prime nearest to 10^n. In case of a tie, choose the smaller.

Original entry on oeis.org

2, 11, 101, 997, 10007, 100003, 1000003, 9999991, 100000007, 1000000007, 10000000019, 100000000003, 999999999989, 9999999999971, 99999999999973, 999999999999989, 10000000000000061, 99999999999999997, 1000000000000000003, 9999999999999999961
Offset: 0

Views

Author

Lekraj Beedassy, Mar 01 2006

Keywords

Crossrefs

Programs

  • Maple
    a:= n-> (t->((p, q)->`if`(q-tAlois P. Heinz, Aug 13 2014
  • Mathematica
    Table[Min[Nearest[{NextPrime[10^n],NextPrime[10^n,-1]},10^n]],{n,0,20}] (* Harvey P. Dale, Mar 14 2023 *)
  • PARI
    for(n=0, 20, a=10^n-precprime(10^n); b=nextprime(10^n)-10^n; if(a<=b && n!=0, print1(precprime(10^n), ", "), print1(nextprime(10^n), ", "))) \\ Felix Fröhlich, Aug 13 2014

Formula

a(n) = 10^n + A117190(n).

Extensions

More terms from Giovanni Resta and Rick L. Shepherd, Mar 01 2006

A139052 Array read by rows: row n lists the first two primes with n digits.

Original entry on oeis.org

2, 3, 11, 13, 101, 103, 1009, 1013, 10007, 10009, 100003, 100019, 1000003, 1000033, 10000019, 10000079, 100000007, 100000037, 1000000007, 1000000009, 10000000019, 10000000033, 100000000003, 100000000019, 1000000000039, 1000000000061
Offset: 1

Views

Author

Omar E. Pol, Apr 08 2008

Keywords

Crossrefs

Programs

  • Mathematica
    ftp[d_]:=Module[{np1=NextPrime[10^(d-1)]},{np1,NextPrime[np1]}]; Array[ ftp,15]//Flatten (* Harvey P. Dale, Mar 27 2021 *)

Extensions

More terms from Sean A. Irvine, Jun 02 2011

A139535 Smallest prime starting with 1 that contains exactly n 0's.

Original entry on oeis.org

101, 1009, 10007, 100003, 1000003, 100000037, 100000007, 1000000007, 100000000019, 100000000003, 10000000000037, 100000000000031, 1000000000000037, 10000000000000061, 100000000000000013
Offset: 1

Views

Author

Lekraj Beedassy, Apr 25 2008

Keywords

Crossrefs

Programs

  • Mathematica
    sp0[n_]:=Module[{c=1,d},While[d=FromDigits[Join[PadRight[{1},n+1,0],IntegerDigits[ c]]];DigitCount[d,10,0]>n||CompositeQ[d],c=c+2];FromDigits[ Join[ PadRight[ {1},n+1,0],IntegerDigits[c]]]]; Array[sp0,20] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Aug 30 2020 *)

A157033 Smallest prime with 2^n digits.

Original entry on oeis.org

2, 11, 1009, 10000019, 1000000000000037, 10000000000000000000000000000033, 1000000000000000000000000000000000000000000000000000000000000121
Offset: 0

Views

Author

Lekraj Beedassy, Feb 22 2009

Keywords

Crossrefs

Programs

  • Mathematica
    f[n_] := NextPrime[10^(2^n - 1)]; Table[f@n, {n, 0, 7}] (* Robert G. Wilson v, Mar 17 2009 *)

A340487 a(n) is the least prime that is the concatenation of two n-digit primes, or 0 if there are none.

Original entry on oeis.org

23, 1117, 101107, 10091021, 1000710181, 100003100129, 10000031000171, 1000001910000349, 100000007100000541, 10000000071000000349, 1000000001910000000319, 100000000003100000000063, 10000000000391000000000903, 1000000000003710000000000259, 100000000000031100000000000403
Offset: 1

Views

Author

J. M. Bergot and Robert Israel, Jan 10 2021

Keywords

Comments

Conjecture: a(n) > 0 and the first n digits of a(n) = A003617(n). - Chai Wah Wu, Jan 13 2021

Examples

			a(3) = 101107 is prime and the concatenation of the two 3-digit primes 101 and 107.
		

Crossrefs

Cf. A003617.

Programs

  • Maple
    f:= proc(d) local P,a,b;
      a:= prevprime(10^(d-1));
      do
        a:= nextprime(a);
        if a > 10^d then return FAIL fi;
        b:= prevprime(10^(d-1));
        do
          b:= nextprime(b);
          if b > 10^d then break fi;
          if isprime(10^d*a+b) then return 10^d*a+b fi;
      od od:
      FAIL
    end proc:
    f(1):= 23:
    map(f, [$1..20]);

A382899 The smallest n-digit prime that turns composite at each step as its digits are successively appended, starting from the first.

Original entry on oeis.org

2, 11, 101, 1013, 10007, 100003, 1000003, 10000019, 100000007, 1000000007, 10000000019, 100000000003, 1000000000061, 10000000000037, 100000000000031, 1000000000000037, 10000000000000061, 100000000000000013, 1000000000000000003, 10000000000000000051
Offset: 1

Views

Author

Jean-Marc Rebert, Apr 08 2025

Keywords

Examples

			a(1) = 2, because 2 is prime, 22 = 2*11 is composite, while no smaller one-digit prime exhibits this property.
a(2) = 11, because 11 is prime, 111 = 3*37 and 1111 = 11*101 are composite, while no smaller two-digit prime exhibits this property.
a(4) = 1013, because 1013 is prime, 10131 = 3 * 11 * 30, 101310 = 2 * 3 * 5 * 11 * 307, 1013101 = 227 * 4463 and 10131013 = 73 * 137 * 1013 are composite, while no smaller 4-digit prime exhibits this property.
		

Crossrefs

Programs

  • PARI
    isok(p, n) = my(d=digits(p)); for (i=1, #d, p = 10*p+d[i]; if (isprime(p), return(0));); return(1);
    a(n) = my(p=nextprime(10^(n-1))); while (!isok(p, n), p = nextprime(p+1)); p; \\ Michel Marcus, Apr 09 2025
    
  • Python
    from sympy import isprime, nextprime
    def c(s): # check if prime p's string of digits meets the concatenation condition
        return not any(isprime(int(s:=s+c)) for c in s)
    def a(n):
        p = nextprime(10**(n-1))
        while not c(str(p)): p = nextprime(p)
        return p
    print([a(n) for n in range(1, 21)]) # Michael S. Branicky, Apr 09 2025

A382981 The smallest n-digit prime that turns composite at each step as its digits are successively appended, starting from the last.

Original entry on oeis.org

2, 11, 101, 1019, 10007, 100043, 1000003, 10000019, 100000007, 1000000007, 10000000019, 100000000003, 1000000000039, 10000000000037, 100000000000031, 1000000000000037, 10000000000000061, 100000000000000003, 1000000000000000003, 10000000000000000051
Offset: 1

Views

Author

Jean-Marc Rebert, Apr 11 2025

Keywords

Examples

			a(4) = 1019, because 1019 is prime and 10199 = 7 * 31 * 47, 101991 = 3 * 33997, 1019910 = 2 * 3 * 5 * 33997 and 10199101 = 11 * 927191 are composite, while no smaller 4-digit prime exhibits this property.
		

Crossrefs

Programs

  • Mathematica
    ok[p_] := Block[{d = IntegerDigits@p}, d = Join[d, Reverse@ d]; And @@ CompositeQ /@ (FromDigits[d[[;; #]]] & /@ Range[Length[d]/2 + 1, Length@d])]; a[n_] := Block[{p = NextPrime[10^(n-1)]}, While[! ok[p], p = NextPrime@p]; p]; Array[a, 20] (* Giovanni Resta, Apr 11 2025 *)
  • Python
    from sympy import isprime, nextprime
    def c(s): # check if prime p's string of digits meets the concatenation condition
        return not any(isprime(int(s:=s+c)) for c in s[::-1])
    def a(n):
        p = nextprime(10**(n-1))
        while not c(str(p)): p = nextprime(p)
        return p
    print([a(n) for n in range(1, 21)]) # Michael S. Branicky, Apr 16 2025

A073862 Difference between the largest and the smallest n-digit prime.

Original entry on oeis.org

5, 86, 896, 8964, 89984, 899980, 8999988, 89999970, 899999930, 8999999960, 89999999958, 899999999986, 8999999999932, 89999999999936, 899999999999958, 8999999999999900, 89999999999999936, 899999999999999986, 8999999999999999958, 89999999999999999938
Offset: 1

Views

Author

Amarnath Murthy, Aug 15 2002

Keywords

Examples

			a(3) = 997 - 101 = 896.
a(1) = 5 because 7-2 = 5.
		

Crossrefs

Programs

  • Maple
    seq(prevprime(10^n)-nextprime(10^(n-1)), n=1..21); # Emeric Deutsch, Mar 28 2005
  • Mathematica
    Table[NextPrime[10^(n+1),-1]-NextPrime[10^n],{n,0,18}] (* Harvey P. Dale, May 04 2016 *)

Formula

a(n) = A003618(n) - A003617(n).

Extensions

More terms from Emeric Deutsch, Mar 28 2005
Previous Showing 21-30 of 58 results. Next