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

A098213 The values of some algorithm.

Original entry on oeis.org

1, 1, 1, 8, 30, 97, 374, 2185, 7399, 60475, 303535, 2332720, 16630294, 41419087, 599216396
Offset: 1

Views

Author

Labos Elemer, Oct 05 2004

Keywords

Comments

The algorithm: Take n consecutive primes starting with the a(n)-th prime: {p(a(n)), ..., p(a(n)+n-1)}. Calculate the absolute differences abs(p(i)-p(j)) for all relevant pairs i,j. The number of distinct entries of this n X n difference matrix equals binomial(n,2) = n(n-1)/2, the maximum possible. Also a(n) is the earliest index such that this diversity of differences reaches the maximum possible, binomial(n,2).
The diagonal [{p(i)-p(i)}] of difference matrices consists only of zeros and can be disregarded.
The complete diversity of k-1 consecutive prime differences [as in A079007] is a necessary but not sufficient condition for providing binomial(k,2) distinct entries in the corresponding k X k difference matrix of k consecutive primes. Consecutive prime differences are para-diagonal entries in the difference matrix. So the conditions here are stronger than in A079007.
Subscripts at which sequences like A098726, A098206-A098212 reach first their possible maximum, i.e., binomial(k,2) with the corresponding k.

Examples

			At n = 1, 2, 3, the maxima are binomial(n,2) = 0, 1, 3 reached at a(n) = 1, 1, 1 respectively.
For n = 7: a(7) = 374, primes = {p(374), ..., p(80)} = {2551, 2557, 2579, 2591, 2593, 2609, 2617}. Building the 7 X 7 matrix of values of abs(p(i)-p(j)), the number of its distinct positive entries equals binomial(7,2)=21, namely: {2, 6, 8, 12, 14, 16, 18, 22, 24, 26, 28, 30, 34, 36, 38, 40, 42, 52, 58, 60, 66}.
For n = 12: a(12) = 2332720, list of 12 primes = {p(n), ..., p(n+11)} = {38238461, ..., 38238737}. 12 X 12 matrix = {abs(p(i)-p(j))}, number of distinct entries = binomial(12,2) = 66, that of {2, 6, 8, ..., 266, 274, 276}.
		

Crossrefs

Programs

  • Mathematica
    a[n_] := Module[{k = 1, v = Prime[Range[n]]}, While[CountDistinct@ Flatten@ Abs@ Outer[Plus, v, -v] - 1 != Binomial[n, 2], k++; v = Join[v[[2 ;; -1]], {NextPrime[v[[-1]]]}]]; k]; Array[a, 10] (* Amiram Eldar, Feb 23 2025 *)
  • PARI
    s(v) = {my(d = List()); for(i = 1, #v, for(j = 1, i-1, listput(d, abs(v[i] - v[j])))); #Set(d);}
    a(n) = {my(k = 1, v = primes(n), t = n*(n-1)/2, j = 1); while(s(v) != t, k++; v[j] = nextprime(1 + if(j==1, v[n], v[j-1])); j++; if(j > n, j -= n)); k;} \\ Amiram Eldar, Feb 23 2025

Formula

a(n) = PrimePi(A099640(n)). - Amiram Eldar, Feb 23 2025

Extensions

Edited by Jon E. Schoenfield, Oct 27 2019
a(14)-a(15) from Amiram Eldar, Feb 23 2025

A098726 Take three consecutive primes starting with the n-th prime. Calculate d(i,j) = abs(prime(i) - prime(j)), for all {i,j}, i.e., all possible differences. a(n) is the number of distinct differences (which can be either 3 or 2).

Original entry on oeis.org

3, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 2, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3, 3, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3
Offset: 1

Views

Author

Labos Elemer, Oct 05 2004

Keywords

Comments

a(n) = 2 iff the consecutive prime differences are equal.
It appears that a(n) = 2 for n in A064113. - Michel Marcus, Jul 27 2017

Crossrefs

Programs

  • Mathematica
    k=3;t=Table[Abs[Prime[n+i]-Prime[n+j]], {i, 0, k-1}, {j, 0, k-1}]; u=Delete[Union[Flatten[t]], 1];a(n)=Length[u]

Extensions

Name edited by Michel Marcus, Jul 27 2017

A123995 First occurrence of prime gaps which are perfect powers.

Original entry on oeis.org

2, 7, 89, 1831, 5591, 9551, 89689, 396733, 3851459, 11981443, 70396393, 202551667, 1872851947, 10958687879, 47203303159, 767644374817, 1999066711391, 8817792098461, 78610833115261, 497687231721157, 2069461000669981
Offset: 1

Views

Author

Walter Kehowski, Oct 31 2006

Keywords

Comments

So far the powers have occurred in numerical order. Here is the list of primes and powers: [7, 4], [89, 8], [1831, 16], [5591, 32], [9551, 36], [89689, 64], [396733, 100], [3851459, 128], [11981443, 144], [70396393, 196], [202551667, 216], [1872851947, 256], [10958687879, 324]. I have searched out to the prime p=26689111613.
The old definition was confusing. What is meant was: primes p such that nextprime(p)-p is an element of A001597 (or A075090: even perfect powers, for n > 1), and p is the smallest prime followed by this gap. - M. F. Hasler, Oct 18 2018
A138198 is a subsequence. - M. F. Hasler, Oct 18 2018

Examples

			a(2)=89 since nextprime(89)-89=97-89=8 is the first occurrence of 8 as a difference between successive primes.
		

Crossrefs

Cf. A080370, A113472, A000230, A001597 (perfect powers), A075090, A002386, A138198.

Programs

  • Maple
    with(numtheory); egcd := proc(n::posint) local L; if n>1 then L:=ifactors(n)[2]; L:=map(z->z[2],L); return igcd(op(L)) else return 1 fi end: P:={}; Q:=[]; p:=2; for w to 1 do for k from 0 do # keep track if k mod 10^6 = 0 then print(k,p) fi; lastprime:=p; q:=nextprime(p); d:=q-p; x:=egcd(d); if x>1 and not d in P then P:=P union {d}; Q:=[op(Q), [p,d]]; print(p,d); print(P); print(Q); fi ; p:=q; od od; # let it run with AutoSave enabled.
  • Mathematica
    NextPrim[n_] := Block[{k = n + 1}, While[ !PrimeQ@k, k++ ]; k]; perfectPowerQ[x_] := GCD @@ Last /@ FactorInteger@x > 1; dd = {1}; pp = {2}; qq = {3}; p = 3; Do[q = NextPrim@p; d = q - p; If[perfectPowerQ@d && ! MemberQ[dd, d], Print@q; AppendTo[pp, p]; AppendTo[dd, d]]; p = q, {n, 10^7}]; pp (* Robert G. Wilson v, Nov 03 2006 *)
  • PARI
    S=[];print1(p=2);forprime(q=1+p,,ispower(q-p)&& !setsearch(S,q-p)&& !print1(","p)&& S=setunion(S,[q-p]);p=q) \\ M. F. Hasler, Oct 18 2018

Formula

Previous prime before A123996.

Extensions

Edited and extended by Robert G. Wilson v, Nov 03 2006 and corrected Nov 04 2006
Better definition from M. F. Hasler, Oct 18 2018

A123996 Smallest prime q such that the gap between q and the previous prime is a perfect power that has not occurred earlier as a gap.

Original entry on oeis.org

3, 11, 97, 1847, 5623, 9587, 89753, 396833, 3851587, 11981587, 70396589, 202551883, 1872852203, 10958688203, 47203303559, 767644375301, 8817792099037, 78610833115937, 497687231721941, 2069461000670881
Offset: 1

Views

Author

Walter Kehowski, Oct 31 2006

Keywords

Comments

So far the powers have occurred in numerical order. Here is the list of primes and powers: [11, 4], [97, 8], [1847, 16], [5623, 32], [9587, 36], [89753, 64], [396833, 100], [3851587, 128], [11981587, 144], [70396589, 196], [202551883, 216], [1872852203, 256], [10958688203, 324]. I have searched out to the prime p=26689111613.

Examples

			a(2)=97 since 97-prevprime(97)=97-89=8 is the first occurrence of 8 as a difference between successive primes.
		

Crossrefs

Programs

  • Maple
    with(numtheory); egcd := proc(n::posint) local L; if n>1 then L:=ifactors(n)[2]; L:=map(z->z[2],L); return igcd(op(L)) else return 1 fi end: P:={}; Q:=[]; p:=2; for w to 1 do for k from 0 do # keep track if k mod 10^6 = 0 then print(k,p) fi; lastprime:=p; q:=nextprime(p); d:=q-p; x:=egcd(d); if x>1 and not d in P then P:=P union {d}; Q:=[op(Q), [q,d]]; print(q,d); print(P); print(Q); fi ; p:=q; od od; # let it run with AutoSave enabled.
  • Mathematica
    NextPrim[n_] := Block[{k = n + 1}, While[ !PrimeQ@k, k++ ]; k]; perfectPowerQ[x_] := GCD @@ Last /@ FactorInteger@x > 1; dd = {1}; pp = {2}; qq = {3}; p = 3; Do[q = NextPrim@p; d = q - p; If[perfectPowerQ@d && !MemberQ[dd, d], Print@q; AppendTo[qq, q]; AppendTo[dd, d]]; p = q, {n, 10^7}]; qq (* Robert G. Wilson v, Nov 03 2006 *)

Formula

Next prime after A123995.

Extensions

Edited and extended by Robert G. Wilson v, Nov 03 2006, corrected Nov 04 2006
Definition corrected by M. F. Hasler, Oct 19 2018

A175540 a(n) = A067076(n) + n.

Original entry on oeis.org

1, 3, 5, 8, 10, 13, 15, 18, 22, 24, 28, 31, 33, 36, 40, 44, 46, 50, 53, 55, 59, 62, 66, 71, 74, 76, 79, 81, 84, 92, 95, 99, 101, 107, 109, 113, 117, 120, 124, 128, 130, 136, 138, 141, 143, 150, 157, 160, 162, 165, 169, 171, 177, 181, 185, 189, 191, 195, 198, 200, 206
Offset: 1

Views

Author

Marc LeBrun, Jun 18 2010

Keywords

Comments

Suggested by the definition of A177018. The first 23 values match with A080370, as do 48 of the first 60 values. Is this a coincidence?

Crossrefs

Showing 1-5 of 5 results.