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

A272863 Numerator of the ratio of consecutive prime gaps.

Original entry on oeis.org

2, 1, 2, 1, 2, 1, 2, 3, 1, 3, 2, 1, 2, 3, 1, 1, 3, 2, 1, 3, 2, 3, 4, 1, 1, 2, 1, 2, 7, 2, 3, 1, 5, 1, 3, 1, 2, 3, 1, 1, 5, 1, 2, 1, 6, 1, 1, 1, 2, 3, 1, 5, 3, 1, 1, 1, 3, 2, 1, 5, 7, 2, 1, 2, 7, 3, 5, 1, 2, 3, 4, 3, 1, 2, 3, 4, 1, 2, 5, 1, 5, 1, 3, 2, 3, 4, 1, 1, 2, 3, 2, 1, 2, 1, 3, 2
Offset: 1

Views

Author

Andres Cicuttin, Jun 21 2016

Keywords

Crossrefs

Cf. A000040, A001223, A274225 (denominators), A274263.
Cf. A184247 (primes of the form prime(k+1) when a(k)=1).

Programs

  • Magma
    [Numerator((NthPrime(n+2)-NthPrime(n+1))/(NthPrime(n+1)-NthPrime(n))): n in [1..100]]; // Vincenzo Librandi, Apr 27 2017
    
  • Mathematica
    Table[(Prime[j+2]-Prime[j+1])/(Prime[j+1]-Prime[j]),{j,1,120}]//Numerator
    Numerator[#[[2]]/#[[1]]]&/@Partition[Differences[Prime[Range[100]]],2,1] (* Harvey P. Dale, Dec 07 2022 *)
  • PARI
    a(n) = numerator((prime(n+2)-prime(n+1))/(prime(n+1)-prime(n))); \\ Michel Marcus, Apr 29 2017

Formula

a(n) = numerator((prime(n+2)-prime(n+1))/(prime(n+1)-prime(n))).
A001223(n) = Product_{k=1..n-1} a(k)/A274225(k). - Andres Cicuttin, Apr 26 2017
A000040(n) = 3 + Sum_{j=1..n-1} Product_{k=1..j} a(k)/A274225(k), for n>1. - Andres Cicuttin, Apr 26 2017

A274225 Denominator of the ratio of consecutive prime gaps.

Original entry on oeis.org

1, 1, 1, 2, 1, 2, 1, 2, 3, 1, 3, 2, 1, 2, 1, 3, 1, 3, 2, 1, 3, 2, 3, 2, 2, 1, 2, 1, 2, 7, 2, 3, 1, 5, 1, 1, 3, 2, 1, 3, 1, 5, 1, 2, 1, 1, 3, 2, 1, 2, 3, 1, 5, 1, 1, 3, 1, 3, 2, 1, 5, 7, 2, 1, 2, 7, 3, 5, 1, 2, 3, 4, 1, 3, 2, 3, 2, 1, 4, 5, 1, 5, 1, 3, 2, 3, 2, 2, 1, 1, 3, 2, 1, 2, 2, 1, 6, 1, 3, 3, 5, 1, 3, 1, 3, 5, 1, 3, 1, 1, 3
Offset: 1

Views

Author

Andres Cicuttin, Jun 19 2016

Keywords

Crossrefs

Cf. A000040, A001223, A272863 (numerators), A274263.

Programs

  • Magma
    [Denominator((NthPrime(n+2)-NthPrime(n+1))/(NthPrime(n+1)-NthPrime(n))): n in [1..100]]; // Vincenzo Librandi, Apr 27 2017
  • Mathematica
    Table[(Prime[j+2]-Prime[j+1])/(Prime[j+1]-Prime[j]),{j,1,120}]//Denominator

Formula

a(n) = denominator((prime(n+2)-prime(n+1))/(prime(n+1)-prime(n))).
From Andres Cicuttin, Apr 26 2017: (Start)
A001223(n) = Product_{k=1..n-1} A272863(k)/a(k).
A000040(n) = 3 + Sum_{j=1..n-1} Product_{k=1..j} A272863(k)/a(k), for n>1. (End)

A276309 Integer part of the ratio of alternate consecutive prime gaps.

Original entry on oeis.org

2, 2, 1, 1, 1, 1, 3, 0, 1, 2, 0, 1, 3, 1, 0, 1, 2, 0, 1, 2, 1, 2, 0, 0, 1, 1, 1, 7, 1, 0, 0, 1, 1, 0, 3, 0, 1, 1, 0, 1, 1, 0, 1, 3, 6, 0, 0, 1, 3, 0, 1, 3, 0, 1, 0, 1, 2, 0, 2, 7, 0, 0, 1, 7, 1, 0, 0, 0, 3, 2, 1, 0, 0, 1, 2, 0, 1, 2, 0, 1, 1, 0, 2, 1, 2, 0, 0, 1, 6, 2, 0, 1, 1, 0, 3, 0
Offset: 1

Views

Author

Andres Cicuttin, Aug 06 2016

Keywords

Comments

Conjectures: The most frequent ratio among alternate prime gaps is 1, while the most frequent ratios among consecutive prime gaps seems to be 2 and 1/2, both with nearly the same frequency (see links). It also appears that next four most frequent ratios are 2, 1/2, 3 and 1/3, all four with nearly the same frequency (see links).

Examples

			For n=2, the second prime is 3, and the next three primes are 5, 7, and 11. So the ratio of prime gaps is (11-7)/(5-3) = 4/2 = 2, and the integer part of this is a(2) = 2. - _Michael B. Porter_, Aug 11 2016
		

Crossrefs

Programs

  • Magma
    [Floor((NthPrime(n+3)-NthPrime(n+2))/(NthPrime(n+ 1)- NthPrime(n))): n in [1..100]]; // Vincenzo Librandi, Aug 30 2016
  • Mathematica
    Table[Floor[(Prime[j + 3] - Prime[j + 2])/(Prime[j + 1] - Prime[j])], {j, 1, 200}]

Formula

a(n) = floor((prime(n + 3) - prime(n + 2))/(prime(n + 1) - prime(n))) .

A275785 Primes such that the ratio between the distance to the next prime and from the previous prime appears for the first time.

Original entry on oeis.org

3, 5, 11, 23, 29, 31, 37, 89, 113, 127, 139, 149, 199, 251, 293, 331, 337, 367, 409, 521, 523, 631, 701, 787, 797, 953, 1087, 1129, 1151, 1259, 1277, 1327, 1361, 1381, 1399, 1657, 1669, 1847, 1933, 1949, 1951, 1973, 2477, 2503, 2579, 2633, 2861, 2879, 2971, 2999, 3089, 3137, 3163, 3229, 3407
Offset: 1

Views

Author

Andres Cicuttin, Nov 14 2016

Keywords

Comments

Number of terms less than 10^n: 2, 8, 26, 85, 224, 511, 1035, 1905, 3338, ..., . - Robert G. Wilson v, Nov 30 2016

Examples

			a(1) = 3 because this is the first prime for which it is possible to determine the ratio between the distance to the next prime (5) and from the previous prime (2). This first ratio is 2.
a(2) = 5 because the ratio between the distance to the next prime (7) and from the previous prime (3) is 1 and this ratio has not appeared before.
The third element a(3) is not 7 because (11-7)/(7-5) = 2, a ratio that appeared before with a(1), so a(3) = 11 because (13-11)/(11-7) = 1/2, a ratio that did not appear before.
		

Crossrefs

Programs

  • Mathematica
    nmax = 720;
    a = Prime[Range[nmax]];
    gaps = Rest[a] - Most[a];
    gapsratio = Rest[gaps]/Most[gaps];
    newpindex = {}; newgratios = {}; i = 1;
    While[i < Length[gapsratio] + 1,
    If[Cases[newgratios, gapsratio[[i]]] == {},
      AppendTo[newpindex, i + 1];
      AppendTo[newgratios, gapsratio[[i]]] ];
      i++];
    Prime[newpindex]
    p = 2; q = 3; r = 5; rtlst = qlst = {}; While[q < 10000, rt = (r - q)/(q - p); If[ !MemberQ[rtlst, rt], AppendTo[rtlst, rt]; AppendTo[qlst, q]]; p = q; q = r; r = NextPrime@ r]; qlst (* Robert G. Wilson v, Nov 30 2016 *)

A289777 Frequency of the largest spectral component of the prime characteristic function of the first n numbers, for n>3, excluding the smallest and largest frequencies. In case of a tie, use the smallest frequency.

Original entry on oeis.org

2, 2, 3, 3, 4, 3, 5, 5, 4, 6, 6, 4, 7, 7, 7, 8, 8, 5, 9, 9, 9, 6, 6, 6, 6, 11, 11, 7, 12, 12, 7, 13, 13, 14, 14, 14, 15, 15, 15, 8, 16, 16, 17, 17, 17, 11, 18, 18, 10, 10, 19, 12, 20, 20, 11, 11, 21, 21, 22, 22, 12, 23, 23, 12, 24, 24, 13, 25, 25, 13, 26, 26, 14, 27, 27, 14, 28, 28, 29, 29, 29, 15, 30, 30, 16, 16
Offset: 4

Views

Author

Andres Cicuttin, Jul 12 2017

Keywords

Comments

The Discrete Fourier transform is applied to the list of the prime characteristic function (A010051) of the first n numbers; then the position of the largest absolute value of the components of the transformed list, disregarding the first and last components, is selected. If there are several identical maxima then the lowest position of them is taken.
The scatter plot of these maximum spectral components exhibits a curious pattern in which these components are essentially aligned along two convergent directions (see link).
It seems that the Fourier spectrum of the prime characteristic function is remarkably symmetric when obtained from a list with an even numer of elements (see link) and it could be related to the symmetry found in the distribution of consecutive and alternate primes gap ratios (see comments and plots in A274263 and A276309).
Conjecture: lim_{n->inf} abs(4a(n)/n - 1) = 1/3.

Examples

			For the first 43 terms of the characteristic function of primes (A010051), the absolute values of its discrete Fourier transform have a maximum at position 8 after excluding the smallest frequency (first position) and the largest frequency (last position), then a(43) = 8.
		

Crossrefs

Programs

  • Mathematica
    PrimeChar[n_] := If[PrimeQ[n] == True, 1, 0];
    Table[Position[b = Abs@Fourier@Table[PrimeChar[j], {j, 1, n}],
       Max[b[[2 ;; Floor[n/2]]]]][[1, 1]], {n, 4, 160}]

A276812 Prime gap residues mod previous prime gap.

Original entry on oeis.org

0, 0, 0, 2, 0, 2, 0, 2, 2, 0, 4, 2, 0, 2, 0, 2, 0, 4, 2, 0, 4, 2, 2, 4, 2, 0, 2, 0, 2, 4, 2, 2, 0, 2, 0, 0, 4, 2, 0, 2, 0, 2, 0, 2, 0, 0, 4, 2, 0, 2, 2, 0, 6, 0, 0, 2, 0, 4, 2, 0, 4, 4, 2, 0, 2, 6, 4, 2, 0, 2, 2, 6, 0, 4, 2, 2, 4, 0, 2, 2, 0, 2, 0, 4, 2, 2, 4, 2, 0, 0, 8, 4, 0, 4, 2, 0, 2, 0, 6, 4
Offset: 1

Views

Author

Andres Cicuttin, Sep 18 2016

Keywords

Examples

			For n = 4: prime(4+2) = 13, prime(4+1) = 11 and prime(4) = 7. (13-11) % (11-7) = 2 % 4 = 2, so a(4) = 2. - _Felix Fröhlich_, Oct 04 2016
		

Crossrefs

Programs

  • Mathematica
    Table[Mod[Prime[n + 2] - Prime[n + 1], Prime[n + 1] - Prime[n]], {n, 1, 100, 1}]
  • PARI
    a(n) = (prime(n+2)-prime(n+1)) % (prime(n+1)-prime(n)) \\ Felix Fröhlich, Oct 04 2016

A303112 Primes p such that (r-q)/(q-p) = 2 or 1/2, and p < q < r are three consecutive primes.

Original entry on oeis.org

2, 5, 7, 11, 13, 17, 37, 41, 67, 89, 97, 101, 103, 107, 191, 193, 223, 227, 277, 307, 311, 347, 389, 397, 449, 457, 461, 479, 487, 491, 503, 613, 641, 739, 757, 761, 821, 823, 853, 857, 877, 881, 907, 929, 991, 1087, 1091, 1231, 1277, 1297, 1301, 1423, 1427, 1439, 1447, 1453
Offset: 1

Views

Author

Andres Cicuttin, Apr 18 2018

Keywords

Comments

Conjecture: The two most frequent ratios between consecutive prime gaps are 2 and 1/2, and both ratios occur with about the same frequency.

Examples

			The first three consecutive primes are 2, 3 and 5, and (5-3)/(3-2)=2, so the first term is a(1)=2, that is, the first prime of (2,3,5).
The next three consecutive primes are 3, 5 and 7, and (7-5)/(5-3)=1, so the first prime of (3,5,7) is not in the list.
The next three consecutive primes are 5, 7 and 11, and (11-7)/(7-5)=2, so the second term is a(2)=5, that is, the first prime of (5,7,11).
The prime 13 is also in the list because (19-17)/(17-13)=1/2.
		

Crossrefs

Cf. A257762 (indices of primes with above ratio = 2).

Programs

  • Mathematica
    b={};
    Do[If[Abs[Log[2,(Prime[j+2]-Prime[j+1])/(Prime[j+1]-Prime[j])]]==1,AppendTo[b,Prime[j]]],{j,1,200}];
    Print@b
    Select[Partition[Prime[Range[250]],3,1],(#[[3]]-#[[2]])/(#[[2]]-#[[1]]) == 2||(#[[3]]-#[[2]])/(#[[2]]-#[[1]])==1/2&][[All,1]] (* Harvey P. Dale, Mar 14 2022 *)
  • PARI
    isok(p) = my(q = nextprime(p+1), r = nextprime(q+1), f = (r-q)/(q-p)); (f == 2) || (f == 1/2);
    forprime(p=2, 1000, if (isok(p), print1(p, ", "))); \\ Michel Marcus, Apr 23 2018

Formula

Conjecture: lim_{n->inf} n/primepi(a(n)) > k > 0 for some k.

A320146 a(n) = 2*prime(n) modulo (prime(n-1) + prime(n+1)).

Original entry on oeis.org

6, 0, 14, 2, 26, 2, 38, 46, 4, 62, 2, 2, 86, 94, 0, 4, 122, 2, 2, 146, 2, 166, 178, 4, 2, 206, 2, 218, 226, 10, 262, 4, 278, 8, 302, 0, 2, 334, 0, 4, 362, 8, 386, 2, 398, 0, 8, 2, 458, 466, 4, 482, 4, 0, 0, 4, 542, 2, 2, 566, 586, 10, 2, 626, 634, 8, 674, 8, 698, 706, 718, 2, 0, 2, 766, 778, 4, 802, 818, 8, 842
Offset: 2

Views

Author

Andres Cicuttin, Oct 06 2018

Keywords

Comments

This sequence has to do with the relative position of primes with respect to their adjacent primes:
(i) if prime(n) is closer to its predecessor than to its successor, then a(n) = 2*prime(n);
(ii) if prime(n) is closer to its successor than to its predecessor, then a(n) = 2*prime(n) - prime(n-1) - prime(n+1); and
(iii) if prime(n) is equidistant from its predecessor and its successor, then a(n) = 0.
Is lim_{n -> infinity} (Sum_{i=1..n} a(i))/(Sum_{i=1..n} prime(i)) finite? If so, what is its value?

Crossrefs

Programs

  • Maple
    seq(modp(2*ithprime(n),(ithprime(n-1)+ithprime(n+1))),n=2..90); # Muniru A Asiru, Oct 07 2018
  • Mathematica
    Table[Mod[2*Prime[n], Prime[n-1] + Prime[n+1]], {n, 2, 120}]
    Mod[2#[[2]],#[[1]]+#[[3]]]&/@Partition[Prime[Range[90]],3,1] (* Harvey P. Dale, Jan 03 2019 *)
  • PARI
    a(n) = 2*prime(n) % (prime(n-1) + prime(n+1)); \\ Michel Marcus, Oct 18 2018

A359354 Position of the first subsequence of n primes that differs from the first n primes, but where the relative distances among their elements coincide with those of the subsequence of first n primes except for a scale factor.

Original entry on oeis.org

2, 2, 3, 238, 28495, 576169, 24635028
Offset: 1

Views

Author

Andres Cicuttin, Dec 27 2022

Keywords

Comments

The first subsequence composed of one prime is {2}, whose unique element has zero distance with itself, and the same happens with the first subsequence of one element {3} that differs from {2}. As these distances are equal to zero they coincide, so a(1) = 2 because subsequence {3} is at position 2 in the sequence of primes.

Examples

			The first subsequence composed of two primes is {2,3}; the distance between its elements is 1. The subsequence of two primes {3,5} is the first subsequence that differs from {2,3}, and the distance between its elements is 2, a distance that coincides with 1 with a scale factor of 1/2, so a(2) = 2 because the first prime in the subsequence {3,5} is the 2nd prime.
The first subsequence composed of three primes is {2,3,5}; the distances between its consecutive elements are (1,2). The first subsequence of three primes {5,7,11} differs from {2,3,5} and the distances between its consecutive elements are (2,4), and these distances coincide with (1,2) with a scale factor of 1/2, so a(3) = 3 because the first prime in the subsequence {5,7,11} is the 3rd prime.
		

Crossrefs

Programs

  • Mathematica
    g[m_] := (Prime[m + 2] - Prime[m + 1])/(Prime[m + 1] - Prime[m]);
    gs[n_] := g[Range[n]];
    nmax = 2^26; (* maximum explorative range to obtain the first elements *)
    seqtot = gs[nmax];
    maxn = 5; (* Number of elements to look for after first two elements {2,2} *)
    {2,2}~Join~Table[SequencePosition[seqtot, gs[j]][[2]][[1]], {j, 1, maxn}]

A359357 Number of different ratios between consecutive prime gaps among the first n primes.

Original entry on oeis.org

1, 2, 2, 3, 3, 3, 3, 4, 5, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 9, 10, 10, 10, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 16, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19
Offset: 3

Views

Author

Andres Cicuttin, Dec 27 2022

Keywords

Comments

What about the asymptotic behavior of a(n), and upper and lower bounds?

Crossrefs

Programs

  • Maple
    P:= [seq(ithprime(i),i=1..102)]:
    G:= P[2..-1]-P[1..-2]:
    R:= G[2..-1] /~ G[1..-2]:
    seq(nops(convert(R[1..n],set)),n=1..100); # Robert Israel, Jan 25 2023
  • Mathematica
    g[m_]:=(Prime[m+2]-Prime[m+1])/(Prime[m+1]-Prime[m]);
    Table[Tally[g[Range[j]]]//Length,{j,1,2^7}]
  • PARI
    f(n) = (prime(n+2)-prime(n+1))/(prime(n+1)-prime(n)); \\ A274263
    a(n) = #Set(vector(n, k, f(k))); \\ Michel Marcus, Dec 28 2022

Formula

a(n) = #{A001223(i+1)/A001223(i)}, i < n-1, where A001223 are prime gaps.
Showing 1-10 of 10 results.