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-6 of 6 results.

A066888 Number of primes p between triangular numbers T(n) < p <= T(n+1).

Original entry on oeis.org

0, 2, 1, 1, 2, 2, 1, 2, 3, 2, 2, 3, 3, 3, 3, 2, 4, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 6, 4, 5, 3, 6, 6, 7, 5, 5, 6, 4, 8, 5, 6, 6, 8, 6, 8, 5, 7, 5, 11, 4, 6, 9, 7, 8, 9, 8, 7, 7, 9, 7, 8, 7, 12, 5, 9, 9, 11, 9, 7, 7, 12, 10, 10, 9, 9, 9, 6, 11, 10, 11, 9, 12, 11, 12, 9, 10, 11, 12, 10, 13, 9, 11, 10, 12
Offset: 0

Views

Author

N. J. A. Sloane, Jun 06 2003

Keywords

Comments

It is conjectured that for n > 0, a(n) > 0. See also A190661. - John W. Nicholson, May 18 2011
If the above conjecture is true, then for any k > 1 there is a prime p > k such that p <= (n+1)(n+2)/2, where n = floor(sqrt(2k)+1/2). Ignoring the floor function we can obtain a looser (but nicer) lower bound of p <= 1 + k + 2*sqrt(2k). - Dmitry Kamenetsky, Nov 26 2016

Examples

			Write the numbers 1, 2, ... in a triangle with n terms in the n-th row; a(n) = number of primes in n-th row.
Triangle begins
   1              (0 primes)
   2  3           (2 primes)
   4  5  6        (1 prime)
   7  8  9 10     (1 prime)
  11 12 13 14 15  (2 primes)
		

Crossrefs

Cf. A083382.
Essentially the same as A065382 and A090970.

Programs

  • Mathematica
    Table[PrimePi[(n^2 + n)/2] - PrimePi[(n^2 - n)/2], {n, 96}] (* Alonso del Arte, Sep 03 2011 *)
    PrimePi[#[[2]]]-PrimePi[#[[1]]]&/@Partition[Accumulate[Range[0,100]],2,1] (* Harvey P. Dale, Jun 04 2019 *)
  • PARI
    { tp(m)=local(r, t); r=1; for(n=1,m,t=0; for(k=r,n+r-1,if(isprime(k),t++)); print1(t","); r=n+r; ) }
    
  • PARI
    {tpf(m)=local(r, t); r=1; for(n=1,m,t=0; for(k=r,n+r-1,if(isprime(k),t++); print1(k" ")); print1(" ("t" prime)"); print(); r=n+r;) }
    
  • Python
    from sympy import primerange
    def A066888(n): return sum(1 for p in primerange((n*(n+1)>>1)+1,((n+2)*(n+1)>>1)+1)) # Chai Wah Wu, May 22 2025

Formula

a(n) = pi(n*(n+1)/2) - pi(n*(n-1)/2).
a(n) equals the number of occurrences of n+1 in A057062. - Esko Ranta, Jul 29 2011

Extensions

More terms from Vladeta Jovovic and Jason Earls, Jun 06 2003
Offset corrected by Daniel Forgues, Sep 05 2012

A111208 Number of primes <= n-th triangular number.

Original entry on oeis.org

0, 0, 2, 3, 4, 6, 8, 9, 11, 14, 16, 18, 21, 24, 27, 30, 32, 36, 39, 42, 46, 50, 54, 58, 62, 66, 70, 74, 79, 84, 90, 94, 99, 102, 108, 114, 121, 126, 131, 137, 141, 149, 154, 160, 166, 174, 180, 188, 193, 200, 205, 216, 220, 226, 235, 242, 250, 259, 267, 274, 281, 290
Offset: 0

Views

Author

Giovanni Teofilatto, Oct 25 2005

Keywords

Comments

Only because of the case n = 2 is it necessary to say "<=", otherwise "<" would suffice. Except for the first two terms, there are no consecutive identical terms for n < 10000. A065382 gives differences between consecutive terms of this sequence. - Alonso del Arte, Oct 31 2005

Crossrefs

Programs

  • Haskell
    a111208 n = length $ takeWhile (<= a000217 n) a000040_list
    -- Reinhard Zumkeller, Nov 01 2011
  • Mathematica
    Table[PrimePi[n*(n + 1)/2], {n, 0, 60}] (* Ray Chandler, Oct 31 2005 *)
  • PARI
    { allocatemem(932245000); default(primelimit, 4294965247); write("b111208.txt", 0, " ", 0); for (n = 1, 10000, t=n*(n + 1)/2; a=primepi(t); write("b111208.txt", n, " ", a); ) } \\ Harry J. Smith, Mar 10 2009
    
  • Sage
    [prime_pi(binomial(n,2)) for n in range(1, 63)] # Zerinvary Lajos, Jun 06 2009
    

Formula

a(n) = A000720(A000217(n)).

Extensions

Extended by Ray Chandler and Alonso del Arte, Oct 31 2005

A065383 a(n) = smallest prime >= n*(n + 1)/2.

Original entry on oeis.org

2, 2, 3, 7, 11, 17, 23, 29, 37, 47, 59, 67, 79, 97, 107, 127, 137, 157, 173, 191, 211, 233, 257, 277, 307, 331, 353, 379, 409, 439, 467, 499, 541, 563, 599, 631, 673, 709, 743, 787, 821, 863, 907, 947, 991, 1039, 1087, 1129, 1181, 1229, 1277, 1327, 1381, 1433
Offset: 0

Views

Author

Reinhard Zumkeller, Nov 05 2001

Keywords

Comments

Besides 7, terms exclude the greater of the twin primes (A006512). - Bill McEachen, Dec 01 2022

Crossrefs

See A097050 for another version.
Cf. A000217.

Programs

  • Haskell
    a065383 n = head $ dropWhile (< a000217 n) a000040_list
    -- Reinhard Zumkeller, Aug 03 2012
  • Mathematica
    PrimeNext[n_]:=Module[{k=n},While[ !PrimeQ[k],k++ ];k];f[n_]:=n*(n+1)/2;lst={};Do[AppendTo[lst,PrimeNext[f[n]]],{n,6!}];lst (* Vladimir Joseph Stephan Orlovsky, Feb 26 2010 *)
    NextPrime/@(Accumulate[Range[0,60]]-1) (* Harvey P. Dale, Jul 31 2012 *)
  • PARI
    { for (n=0, 1000, write("b065383.txt", n, " ", nextprime(n*(n + 1)/2)) ) } \\ Harry J. Smith, Oct 17 2009
    

Extensions

Edited by N. J. A. Sloane, Nov 21 2008

A090970 Number of primes strictly between T(n) and T(n+1), where T(n) = n-th triangular number.

Original entry on oeis.org

1, 1, 1, 2, 2, 1, 2, 3, 2, 2, 3, 3, 3, 3, 2, 4, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 6, 4, 5, 3, 6, 6, 7, 5, 5, 6, 4, 8, 5, 6, 6, 8, 6, 8, 5, 7, 5, 11, 4, 6, 9, 7, 8, 9, 8, 7, 7, 9, 7, 8, 7, 12, 5, 9, 9, 11, 9, 7, 7, 12, 10, 10, 9, 9, 9, 6, 11, 10, 11, 9, 12, 11, 12, 9, 10, 11, 12, 10, 13, 9, 11, 10, 12
Offset: 1

Views

Author

Amarnath Murthy, Jan 03 2004

Keywords

Examples

			a(8)=3 because between T(8)=36 and T(9)=45 we have the prime numbers 37,41 and 43.
		

Crossrefs

Essentially the same as A065382 and A066888.

Programs

  • Maple
    a:= proc(n) local ct,j: ct:=0: for j from n*(n+1)/2+1 to (n+1)*(n+2)/2-1 do if isprime(j)=true then ct:=ct+1 else ct:=ct fi: od: end: seq(a(n),n=1..103); # Emeric Deutsch, Feb 23 2005
  • Mathematica
    With[{trs=Partition[Accumulate[Range[100]],2,1]},Join[{1},Rest[ PrimePi[ #[[2]]]- PrimePi[#[[1]]]&/@trs]]] (* Harvey P. Dale, Aug 25 2015 *)
  • Python
    from sympy import primerange
    def A090970(n): return sum(1 for p in primerange((n*(n+1)>>1)+1,(n+2)*(n+1)>>1)) # Chai Wah Wu, May 22 2025

Extensions

More terms from Emeric Deutsch, Feb 23 2005

A065384 Largest prime <= n * (n + 1) / 2.

Original entry on oeis.org

3, 5, 7, 13, 19, 23, 31, 43, 53, 61, 73, 89, 103, 113, 131, 151, 167, 181, 199, 229, 251, 271, 293, 317, 349, 373, 401, 433, 463, 491, 523, 557, 593, 619, 661, 701, 739, 773, 811, 859, 887, 941, 983, 1033, 1069, 1123, 1171, 1223, 1259, 1321, 1373, 1429, 1483
Offset: 2

Views

Author

Reinhard Zumkeller, Nov 05 2001

Keywords

Crossrefs

Programs

  • Mathematica
    PrimePrev[n_]:=Module[{k=n},While[ !PrimeQ[k],k-- ];k];f[n_]:=n*(n+1)/2;lst={};Do[AppendTo[lst,PrimePrev[f[n]]],{n,6!}];lst (* Vladimir Joseph Stephan Orlovsky, Feb 26 2010 *)
  • PARI
    { for (n=2, 1000, write("b065384.txt", n, " ", precprime(n*(n + 1)/2)) ) } [Harry J. Smith, Oct 17 2009]

A282518 Number of n-element subsets of [n+1] having a prime element sum.

Original entry on oeis.org

0, 1, 2, 1, 2, 2, 1, 2, 3, 2, 2, 3, 3, 3, 3, 2, 4, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 6, 4, 5, 3, 6, 6, 7, 5, 5, 6, 4, 8, 5, 6, 6, 8, 6, 8, 5, 7, 5, 11, 4, 6, 9, 7, 8, 9, 8, 7, 7, 9, 7, 8, 7, 12, 5, 9, 9, 11, 9, 7, 7, 12, 10, 10, 9, 9, 9, 6, 11, 10, 11, 9, 12
Offset: 0

Views

Author

Alois P. Heinz, Feb 17 2017

Keywords

Examples

			a(1) = 1: {2}.
a(2) = 2: {1,2}, {2,3}.
a(3) = 1: {1,2,4}.
a(4) = 2: {1,2,3,5}, {1,3,4,5}.
a(5) = 2: {1,2,3,5,6}, {1,3,4,5,6}.
a(6) = 1: {1,2,3,4,6,7}.
a(7) = 2: {1,2,3,4,5,6,8}, {1,2,3,4,6,7,8}.
a(8) = 3: {1,2,3,4,5,6,7,9}, {1,2,3,5,6,7,8,9}, {1,3,4,5,6,7,8,9}.
		

Crossrefs

Similar but different: A065382, A066888, A090970.

Programs

  • Maple
    a:= proc(n) option remember; (t-> add(`if`(isprime(
           t-i), 1, 0), i=1..n+1))((n+1)*(n+2)/2)
        end:
    seq(a(n), n=0..100);

Formula

a(n) = A282516(n+1,n).
a(n) = pi((n+1)*(n+2)/2)-pi(n*(n+1)/2) for n >= 3, pi = A000720.
Showing 1-6 of 6 results.