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

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))) .

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

A286634 Numerator of the ratio of alternate consecutive prime gaps: Numerator ((prime(n + 3) - prime(n + 2))/(prime(n + 1) - prime(n))).

Original entry on oeis.org

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

Views

Author

Andres Cicuttin, May 11 2017

Keywords

Crossrefs

Cf. A285851 (denominators), A001223, A000040, A272863, A276309.

Programs

  • Mathematica
    Table[Numerator[(Prime[k+3]-Prime[k+2])/(Prime[k+1]-Prime[k])], {k, 100}]

Formula

a(n) = numerator((prime(n + 3) - prime(n + 2))/(prime(n + 1) - prime(n))).
A000040(n+3) = 5 + Sum_{k=1..n} ((1+(-1)^k)*Product_{j=1..k}(a(j)/A285851(j))^((1+(-1)^j)/2) + ((1-(-1)^k)/2)*Product_{j=1..k}(a(j)/A285851(j))^((1-(-1)^j)/2)), for n>0.
A001223(n+2) = (1+(-1)^n)*Product_{j=1..n}(a(j)/A285851(j))^((1+(-1)^j)/2) - ((-1+(-1)^n)/2)*Product_{j=1..n}(a(j)/A285851(j))^((1-(-1)^j)/2), for n>0

A358200 Frequency ranking position of the ratio r(n) between consecutive prime gaps, among all previous ratios {r(i) : 2 < i < n, r(i) = (prime(i) - prime(i-1))/(prime(i-1) - prime(i-2))}. If the ratio r(n) is not among previous ratios, then a(n)=n.

Original entry on oeis.org

4, 2, 6, 1, 2, 1, 10, 11, 12, 13, 2, 1, 6, 6, 5, 7, 7, 2, 7, 5, 7, 25, 2, 1, 2, 1, 2, 31, 32, 4, 6, 35, 36, 6, 7, 6, 4, 7, 7, 12, 9, 2, 2, 47, 6, 5, 1, 2, 5, 4, 9, 55, 5, 4, 4, 7, 7, 1, 8, 63, 10, 1, 2, 14, 68, 69, 9, 2, 5, 14, 74, 4, 6, 5, 11, 1, 2, 81, 9, 9, 9, 8, 6, 4, 10, 1, 1, 2, 7, 6, 1, 2, 1, 3, 2, 99, 100, 6, 19, 16
Offset: 4

Views

Author

Andres Cicuttin, Feb 22 2023

Keywords

Comments

Given all primes up to prime(n-1) with n > 3, if a(n) != n then a(n) is the number of attempts to find the prime(n) using to the following algorithm:
1) Calculate all previous consecutive prime-gaps ratios psr(n) = {r(i) : 2 < i < n, r(i) = (prime(i) - prime(i-1))/(prime(i-1) - prime(i-2))}.
2) Tally the elements {r(i)} and sort them according to their frequencies in descending order first, and then by their values in ascending order.
3) Check the primality of candidates q in the same order as the ratio (q - prime(n-1))/(prime(n-1) - prime(n-2)) appears in the ordered set obtained above.
In the first 2^17 primes the median of all consecutive prime-gaps ratios is 16 and there are 621 different ratios.
Conjectures:
1) a(n)=n or a(n) < x*n^y with x ~ 6 and y ~ 0.4 (verified for first 2^16 primes).
2) The sequence is unbounded. (Equivalent to conjecture in A001223 on Sep 29 2018.)
3) The relative frequencies (probabilities) of the consecutive prime-gap ratios approach constants as the length of the list of first primes approaches infinity. (Equivalent to conjecture in A001223 on Sep 01 2019.)

Examples

			In the table below for the first terms, the columns are: index n, primes(n), consecutive prime-gaps ratio r(n), previous sorted ratios psr(n), and a(n).
   n  prime(n)  r(n)  psr(n)                        a(n)
   1    2       -     {}                             -
   2    3       -     {}                             -
   3    5       2     {}                             -
   4    7       1     {2}                            4
   5   11       2     {1, 2}                         2
   6   13       1/2   {2, 1}                         6
   7   17       2     {2, 1/2, 1}                    1
   8   19       1/2   {2, 1/2, 1}                    2
   9   23       2     {2, 1/2, 1}                    1
  10   29       3/2   {2, 1/2, 1}                    10
  11   31       1/3   {2, 1/2, 1, 3/2}               11
  12   37       3     {2, 1/2, 1/3, 1, 3/2}          12
  13   41       2/3   {2, 1/2, 1/3, 1, 3/2, 3}       13
  14   43       1/2   {2, 1/2, 1/3, 2/3, 1, 3/2, 3}  2
a(4), a(6), a(10), a(11), a(12) and a(13) are respectively 4, 6, 10, 11, 12 and 13 because the corresponding ratios 1, 1/2, 3/2, 1/3, 3 and 2/3 are ratios that appear for the first time.
a(5) = 2 because the corresponding ratio r(5)=2 is at the second position in the ordered set of previous ratios psr(5)={1, 2}.
a(9) = 1 because the corresponding ratio r(9)=2 is at the first position in the ordered set of previous ratios psr(7)={2, 1/2, 1}.
		

Crossrefs

Cf. A001223 (Prime gaps), A275785, A276812, A272863, A274225.

Programs

  • Mathematica
    p[n_]:= Prime[n];
    (* consecutive prime-gaps ratio *)
    r[n_]:= (p[n] - p[n - 1])/(p[n - 1] - p[n - 2]);
    (* sorted ratios according to increasing frequency and decreasing value *)
    fracs[n_]:= Transpose[SortBy[Tally[r[Range[3, n]]], {-#[[2]] &, #[[1]] &}]][[1]];
    SetAttributes[fracs, Listable];
    (* Position of the new ratio r[j] in previous list, or j if not present *)
    a[j_] := Append[Position[fracs[j - 1], r[j]], {j}] // First // First;
    SetAttributes[a, Listable];
    (* First 100 terms starting from n=4 *)
    a[Range[4,103]]

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