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

A075402 Smallest number such that a(n) + T(n) is a prime, where T(n) is the n-th triangular number.

Original entry on oeis.org

1, 0, 1, 1, 2, 2, 1, 1, 2, 4, 1, 1, 6, 2, 7, 1, 4, 2, 1, 1, 2, 4, 1, 7, 6, 2, 1, 3, 4, 2, 3, 13, 2, 4, 1, 7, 6, 2, 7, 1, 2, 4, 1, 1, 4, 6, 1, 5, 4, 2, 1, 3, 2, 2, 3, 1, 4, 10, 7, 1, 10, 20, 1, 1, 8, 2, 3, 1, 2, 18, 1, 5, 6, 2, 1, 1, 8, 2, 3, 11, 2, 4, 5, 1, 4, 20, 5, 1, 2, 4, 15, 5, 2, 16, 1, 1, 6, 10, 1
Offset: 1

Views

Author

Amarnath Murthy, Sep 23 2002

Keywords

Comments

0 occurs only once in this sequence.

Crossrefs

Cf. A075403.

Programs

  • Mathematica
    If[PrimeQ[#],#,NextPrime[#]]-#&/@Accumulate[Range[100]] (* Harvey P. Dale, Nov 21 2012 *)
  • PARI
    for(n=1,100,a=n*(n+1)/2:print1(nextprime(a)-a","))

Extensions

Corrected and extended by Ralf Stephan, Mar 19 2003

A309877 a(n) is the smallest number k such that the difference between the next prime greater than k and k equals n.

Original entry on oeis.org

1, 0, 8, 7, 24, 23, 90, 89, 118, 117, 116, 115, 114, 113, 526, 525, 524, 523, 888, 887, 1130, 1129, 1338, 1337, 1336, 1335, 1334, 1333, 1332, 1331, 1330, 1329, 1328, 1327, 9552, 9551, 15690, 15689, 15688, 15687, 15686, 15685, 15684, 15683, 19616, 19615, 19614, 19613, 19612, 19611
Offset: 1

Views

Author

Ilya Gutkovskiy, Aug 21 2019

Keywords

Examples

			+------+------+-----+
| a(n) | next | gap |
|      | prime|     |
+------+------+-----+
|   1  |   2  |  1  |
|   0  |   2  |  2  |
|   8  |  11  |  3  |
|   7  |  11  |  4  |
|  24  |  29  |  5  |
|  23  |  29  |  6  |
|  90  |  97  |  7  |
|  89  |  97  |  8  |
+------+------+-----+
		

Crossrefs

Programs

  • Maple
    N:= 100:
    A:= Vector(N,-1):
    count:= 0: lastp:= 0:
    while count < N do
      p:= nextprime(lastp);
      newvals:= select(t -> A[t]=-1, [$1..min(p-lastp,N)]);
      count:= count+nops(newvals);
      for k in newvals do A[k]:= p-k od;
      lastp:= p;
    od:
    convert(A,list); # Robert Israel, Aug 23 2019
  • Mathematica
    Table[SelectFirst[Range[0, 20000], NextPrime[#] - # == n &], {n, 1, 50}]
    Module[{nn=20000,d},d=Table[{n,NextPrime[n]-n},{n,0,nn}];Table[SelectFirst[d,#[[2]]==k&],{k,50}]][[;;,1]] (* Harvey P. Dale, Mar 23 2025 *)
  • PARI
    a(n) = my(k=0); while(nextprime(k+1) - k != n, k++); k; \\ Michel Marcus, Aug 21 2019

Formula

a(n) = min {k : A013632(k) = n}.
Showing 1-2 of 2 results.