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.

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

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