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.

Previous Showing 41-50 of 981 results. Next

A356223 Position of n-th appearance of 2n in the sequence of prime gaps (A001223). If 2n does not appear at least n times, set a(n) = -1.

Original entry on oeis.org

2, 6, 15, 79, 68, 121, 162, 445, 416, 971, 836, 987, 2888, 1891, 1650, 5637, 5518, 4834, 9237, 8152, 10045, 21550, 20248, 20179, 29914, 36070, 24237, 53355, 52873, 34206, 103134, 90190, 63755, 147861, 98103, 117467, 209102, 206423, 124954, 237847, 369223
Offset: 1

Views

Author

Gus Wiseman, Aug 04 2022

Keywords

Comments

Prime gaps (A001223) are the differences between consecutive prime numbers. They begin: 1, 2, 2, 4, 2, 4, 2, 4, 6, ...

Examples

			We need the first 15 prime gaps (1, 2, 2, 4, 2, 4, 2, 4, 6, 2, 6, 4, 2, 4, 6) before we reach the 3rd appearance of 6, so a(6) = 15.
		

Crossrefs

The first appearances are at A038664, seconds A356221.
Diagonal of A356222.
A001223 lists the prime gaps.
A073491 lists numbers with gapless prime indices.
A356224 counts divisors with gapless prime indices, complement A356225.
A356226 = gapless interval lengths of prime indices, run-lengths A287170.

Programs

  • Mathematica
    nn=1000;
    gaps=Differences[Array[Prime,nn]];
    Table[Position[gaps,2*n][[n,1]],{n,Select[Range[nn],Length[Position[gaps,2*#]]>=#&]}]

A376343 Positions of twos in the run-compressed (A037201) first differences (A001223) of the primes (A000040).

Original entry on oeis.org

2, 4, 6, 9, 12, 15, 18, 24, 26, 31, 33, 37, 39, 41, 44, 47, 50, 53, 57, 62, 73, 75, 81, 90, 95, 99, 102, 105, 108, 127, 129, 131, 135, 139, 156, 158, 161, 163, 167, 173, 182, 187, 190, 193, 196, 205, 210, 214, 216, 232, 235, 241, 244, 247, 254, 263, 265, 270
Offset: 1

Views

Author

Gus Wiseman, Sep 26 2024

Keywords

Comments

We define the run-compression of a sequence to be the anti-run obtained by reducing each run of repeated parts to a single part. Alternatively, we can remove all parts equal to the part immediately to their left. For example, (1,1,2,2,1) has run-compression (1,2,1).

Examples

			The sequence of prime numbers (A000040) is:
  2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, ...
with first differences (A001223):
  1, 2, 2, 4, 2, 4, 2, 4, 6, 2, 6, 4, 2, 4, 6, 6, 2, 6, 4, 2, 6, 4, 6, 8, 4, 2, 4, ...
with run-compression (A037201):
  1, 2, 4, 2, 4, 2, 4, 6, 2, 6, 4, 2, 4, 6, 2, 6, 4, 2, 6, 4, 6, 8, 4, 2, 4, 2, 4, ...
with twos at (A376343):
  2, 4, 6, 9, 12, 15, 18, 24, 26, 31, 33, 37, 39, 41, 44, 47, 50, 53, 57, 62, 73, ...
		

Crossrefs

Positions of 2's in A037201.
The repeats were at positions A064113 before being omitted.
A variation for squarefree numbers is A376342.
A000040 lists the prime numbers, differences A001223.
A000961 and A246655 list prime-powers, differences A057820.
A005117 lists squarefree numbers, differences A076259 (ones A375927).
A013929 lists nonsquarefree numbers, differences A078147.
A333254 lists run-lengths of differences between consecutive primes.

Programs

  • Mathematica
    Join@@Position[First/@Split[Differences[Select[Range[100],PrimeQ]]],2]

Formula

For just the odd primes we have a(n) - 1.

A376521 Sorted positions of first appearances in the run-compression (A037201) of the first differences (A001223) of the prime numbers (A000040).

Original entry on oeis.org

1, 2, 3, 8, 22, 28, 32, 42, 91, 141, 172, 198, 242, 259, 341, 400, 556, 692, 1119, 1737, 1779, 2072, 2101, 2913, 3126, 3204, 3246, 3457, 3598, 4294, 4383, 7596, 7651, 8284, 11986, 13729, 14220, 15101, 16273, 18217, 22303, 29523, 30243, 32236, 32808, 32820
Offset: 1

Views

Author

Gus Wiseman, Sep 26 2024

Keywords

Comments

We define the run-compression of a sequence to be the anti-run obtained by reducing each run of repeated parts to a single part. Alternatively, we can remove all parts equal to the part immediately to their left. For example, (1,1,2,2,1) has run-compression (1,2,1).

Examples

			The sequence of prime numbers (A000040) is:
  2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, ...
with first differences (A001223):
  1, 2, 2, 4, 2, 4, 2, 4, 6, 2, 6, 4, 2, 4, 6, 6, 2, 6, 4, 2, 6, 4, 6, 8, 4, 2, 4, ...
with run-compression (A037201):
  1, 2, 4, 2, 4, 2, 4, 6, 2, 6, 4, 2, 4, 6, 2, 6, 4, 2, 6, 4, 6, 8, 4, 2, 4, 2, 4, ...
with first appearances at (A376521):
  1, 2, 3, 8, 22, 28, 32, 42, 91, 141, 172, 198, 242, 259, 341, 400, 556, 692, 1119, ...
		

Crossrefs

These are the sorted positions of first appearances in A037201.
For positions of twos instead of first appearances we have A376343.
The unsorted version is A376520.
A000040 lists the prime numbers, differences A001223.
A003242 counts compressed compositions, ranks A333489.
A333254 lists run-lengths of differences between consecutive primes.
A373948 encodes compression using compositions in standard order.

Programs

  • Mathematica
    q=First/@Split[Differences[Select[Range[1000],PrimeQ]]];
    Select[Range[Length[q]],!MemberQ[Take[q,#-1],q[[#]]]&]

A053597 Let prime(i) = i-th prime (A000040), let d(i) = prime(i+1)-prime(i) (A001223); a(n) = number of distinct numbers among d(n), d(n+1), d(n+2), ... before first duplicate is encountered.

Original entry on oeis.org

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

Views

Author

N. J. A. Sloane, Jan 07 2003

Keywords

Examples

			The d sequence starting at prime(7) = 17 is d(7) = 2, d(8) = 4, d(9) = 6, d(10) = 2, with three numbers before the first duplication, so a(7) = 3.
		

Crossrefs

A078515 gives RECORDS transform of this sequence. See also A079007.

Programs

  • Maple
    P:= [seq(ithprime(i),i=1..1000)]:
    G:= P[2..-1]-P[1..-2]:
    R:= Vector(990):
    for i from 1 to 990 do
      for k from 1 while nops(convert(G[i..i+k-1],set))=k do od:
      R[i]:= k-1;
    od:
    convert(R,list);
  • Mathematica
    f[n_] := Block[{k = 1}, While[p = Table[ Prime[i], {i, n, n + k}]; Length[ Union[ Drop[p, 1] - Drop[p, -1]]] == k, k++ ]; k - 1]; Table[ f[n], {n, 1, 105}]

Extensions

More terms from Robert G. Wilson v, Jan 07 2002

A082509 Differences between consecutive primes that are not powers of 2 in order of their appearance. Differences which are powers of 2 are omitted from A001223.

Original entry on oeis.org

6, 6, 6, 6, 6, 6, 6, 14, 6, 10, 6, 6, 6, 6, 10, 12, 12, 6, 10, 6, 6, 6, 6, 10, 14, 14, 6, 10, 6, 6, 6, 6, 10, 10, 6, 6, 12, 6, 12, 18, 6, 10, 6, 6, 6, 10, 6, 6, 6, 6, 12, 10, 6, 6, 12, 6, 10, 10, 6, 6, 6, 14, 10, 12, 10, 10, 14, 14, 20, 10, 6, 6, 14, 6, 6, 6, 12, 6, 10, 6, 10, 10, 6, 18, 6, 6, 6
Offset: 1

Views

Author

Labos Elemer, Apr 28 2003

Keywords

Crossrefs

Programs

  • Mathematica
    Do[s=Log[2, Prime[n+1]-Prime[n]]; If[ !IntegerQ[s], Print[Prime[n+1]]], {n, 1, 1000}]
    Module[{nn=250,twos},twos=2^Range[0,Floor[Log[2,Prime[nn]]]];Select[ Differences[ Prime[Range[nn]]],!MemberQ[twos,#]&]] (* Harvey P. Dale, Apr 18 2012 *)
  • PARI
    list(lim) = {my(p = 2, d); forprime(q = 3, lim, d = q - p; if(d >> valuation(d, 2) > 1, print1(d, ", ")); p = q);} \\ Amiram Eldar, Feb 16 2025

A083551 Least common multiple of 2 consecutive prime differences, of two successive terms of A001223.

Original entry on oeis.org

2, 2, 4, 4, 4, 4, 4, 12, 6, 6, 12, 4, 4, 12, 6, 6, 6, 12, 4, 6, 12, 12, 24, 8, 4, 4, 4, 4, 28, 28, 12, 6, 10, 10, 6, 6, 12, 12, 6, 6, 10, 10, 4, 4, 12, 12, 12, 4, 4, 12, 6, 10, 30, 6, 6, 6, 6, 12, 4, 10, 70, 28, 4, 4, 28, 42, 30, 10, 4, 12, 24, 24, 6, 12, 12, 24, 8, 8, 40, 10, 10, 10, 6, 12
Offset: 1

Views

Author

Labos Elemer, May 22 2003

Keywords

Crossrefs

Programs

  • Mathematica
    f[x_] := Prime[x+1]-Prime[x];  Table[LCM[f[w+1], f[w]], {w, 1, 128}]
    Table[LCM[(Prime[n + 1] - Prime[n]), Prime[n + 2] - Prime[n + 1]], {n, 100}] (* Vincenzo Librandi, Mar 15 2018 *)
    LCM@@#&/@Partition[Differences[Prime[Range[90]]],2,1] (* Harvey P. Dale, Oct 11 2020 *)

Formula

a(n) = lcm(A001223(n), A001223(n+1)).

A084299 Smallest primes such that the subsequent terms of consecutive prime differences (A001223) modulo 6 (A054763) displays repeatedly n times a {0,2,4} pattern of remainders of differences.

Original entry on oeis.org

83, 2903, 5897, 319499, 346943, 7974179, 15262433, 33954251, 5521833683, 83993232497, 848099080883, 1293322433639
Offset: 1

Views

Author

Labos Elemer, Jun 02 2003

Keywords

Examples

			For n=1: a(1) = 83 is followed by [6,8,4].
For n=2: a(2) = 2903 is followed by [6,2,4,18,2,4].
For n=3: a(3) = 5897 is followed by [6,20,4,12,14,28,6,20,4].
For n=4: a(4) = 319499 is followed by [12,8,22,6,20,10,12,2,10,6,32,34].
For n=5: a(5) = 346943 is followed by [18,2,40,....,30,2,10] differences corresponding to n "wavelet" of [0,2,4] remainders modulo 6.
		

Crossrefs

Programs

  • Mathematica
    (* generates a(5) *) d[x_] := Prime[x+1]-Prime[x]; md[x_] := Mod[Prime[x+1]-Prime[x], 6]; h={k1=0, k2=2, k3=4}; k=0; Do[If[Equal[md[n], k1]&&Equal[md[n+1], k2]&& Equal[md[n+2], k3]&&Equal[md[n+3], k1]&&Equal[md[n+4], k2]&&Equal[md[n+5], k3] &&Equal[md[n+6], k1]&&Equal[md[n+7], k2]&&Equal[md[n+8], k3] &&Equal[md[n+9], k1]&&Equal[md[n+10], k2]&&Equal[md[n+11], k3]&& Equal[md[n+12], k1]&&Equal[md[n+13], k2]&&Equal[md[n+14], k3], k=k+1; Print[{k, n, Prime[n], Table[md[n+j], {j, -1, 15}], Table[d[n+j], {j, -1, 15}]}]], {n, 2, 10000000}]
  • PARI
    lista(pmax) = {my(rec = 0, m = 0, c = 0, prv = 2, p0 = 0, d); forprime(p = 3, pmax, d = (p-prv)%6; if(d == 0 && m == 0, p0 = prv); if(d == c, m++; c = (c+2)%6; if(!(m%3) && m/3 > rec, print1(p0, ", "); rec++; m = 0), if(d == 0, p0 = prv; c = 2; m = 1, c = 0; m = 0)); prv = p);} \\ Amiram Eldar, Nov 04 2024

Extensions

a(9)-a(12) from Amiram Eldar, Nov 04 2024

A118380 Primes for which the weight as defined in A117078 is 15 and the gap as defined in A001223 is 14.

Original entry on oeis.org

839, 1409, 2039, 2819, 2939, 3779, 4139, 4889, 5309, 5669, 5939, 6719, 8039, 8609, 10739, 11369, 11909, 12329, 13049, 13499, 13859, 14159, 14489, 14519, 14639, 14669
Offset: 1

Views

Author

Rémi Eismann, May 24 2006, May 04 2007

Keywords

Comments

The prime numbers in this sequence are of the form (30i-1) with i=(level(n)+1)/2, level(n) defined in A117563.

Examples

			Prime(147) = prime(146) + prime(146)mod(15) = 839 + 839 mod(15) = 853 839 mod (5) = 4.
		

Crossrefs

A124434 LCM (least common multiple) of A001043 (sum of consecutive primes) and A001223 (difference of consecutive primes).

Original entry on oeis.org

5, 8, 12, 36, 24, 60, 36, 84, 156, 60, 204, 156, 84, 180, 300, 336, 120, 384, 276, 144, 456, 324, 516, 744, 396, 204, 420, 216, 444, 1680, 516, 804, 276, 1440, 300, 924, 960, 660, 1020, 1056, 360, 1860, 384, 780, 396, 2460, 2604, 900, 456, 924, 1416, 480, 2460
Offset: 1

Views

Author

Mitch Cervinka (Mitch.Cervinka(AT)eds.com), Dec 15 2006

Keywords

Examples

			a(3)=12 because prime(3)=5, prime(4)=7 and lcm(7+5, 7-5) = lcm(12,2) = 12.
		

Crossrefs

Programs

  • Mathematica
    LCM[Total[#],#[[2]]-#[[1]]]&/@Partition[Prime[Range[60]],2,1] (* Harvey P. Dale, Apr 19 2013 *)
    Join[{5}, Table[(Prime[n + 1]^2 - Prime[n]^2)/2, {n, 2, 59}]] (* Jon Maiga, Jan 17 2019 *)
  • PARI
    a(n) = my(p = prime(n), q = prime(n+1)); lcm(q+p, q-p); \\ Michel Marcus, Mar 15 2018

Formula

a(n) = lcm((prime(n+1)+prime(n)), (prime(n+1)-prime(n))).
a(n) = (prime(n+1)^2 - prime(n)^2)/2 for n > 1. - Jon Maiga, Jan 17 2019

A198696 Positions of local maxima in differences of primes, A001223.

Original entry on oeis.org

4, 6, 9, 11, 18, 21, 24, 27, 30, 32, 34, 42, 44, 51, 53, 58, 62, 66, 68, 72, 77, 80, 82, 84, 87, 91, 94, 97, 99, 101, 106, 114, 121, 125, 127, 132, 135, 137, 139, 141, 143, 146, 150, 154, 157, 162, 166, 168, 170, 172, 175, 177, 180, 186, 189, 191, 193, 197
Offset: 1

Views

Author

Zak Seidov, Oct 29 2011

Keywords

Comments

Or, numbers n such that A001223(n-1) < A001223(n) > A001223(n+1).
Corresponding values of local maxima (4, 4, 6, 6, 6, 6, 8,...) are in A198697.

Crossrefs

Cf. A196175 local minima in A001223 (first differences of primes), A198697.

Programs

  • Mathematica
    nn = 1001; t = Differences[Prime[Range[nn]]]; t2 = {}; Do[If[t[[n - 1]] < t[[n]] && t[[n]] > t[[n + 1]], AppendTo[t2, {n, t[[n]]}]], {n, 2, nn - 2}]; Transpose[t2][[1]] (* T. D. Noe, Dec 27 2011 *)
Previous Showing 41-50 of 981 results. Next