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

A280941 Least integer k such that prime(k+1) - prime(k) = 2 and prime(k+2) - prime(k+1) = 2n, or 0 if no such k exists.

Original entry on oeis.org

2, 3, 10, 0, 33, 45, 0, 294, 98, 0, 296, 262, 0, 428, 984, 0, 1456, 3086, 0, 2343, 1878, 0, 14938, 8422, 0, 2809, 4259, 0, 7809, 13819, 0, 51036, 45506, 0, 15782, 30764, 0, 57764, 24553, 0, 23282, 51942, 0, 44902, 34214, 0, 1242641, 95929, 0, 66761
Offset: 1

Views

Author

Michel Lagneau, Jan 11 2017

Keywords

Comments

Or least integer k such that prime(k+2) - prime(k+1) = 2n where prime(k) is in A001359 (lesser of twin primes).
The corresponding prime(k) are 3, 5, 29, 137, 197, 1931, 521, 1949, 1667, 2969, 7757, 12161, 28349, 20807, ...
a(n) is a subsequence of A029707(n) or subsequence of A107770(n) - 1.
a(n) = 0 for n == 1 mod 3 for n > 1.
Proof: prime(k+1) - prime(k) = 2 => prime(k+1) == 1 mod 6 and prime(k) == -1 mod 6. If prime(k+2) - prime(k+1) = 2n, then prime(k+2) = 2(n+1) + prime(k). Combining n == 1 mod 3 and prime(k) == -1 mod 6 we obtain prime(k+2) == 3 mod 6, a contradiction because prime(k+2) == +-1 mod 6. Hence, a(n) = 0.

Examples

			a(3) = 10 because prime(11) - prime(10) = 31 - 29 = 2 and prime(12) - prime(11) = 37 - 31 = 6 = 2*3.
a(11) = 296 because prime(297) - prime(296) = 1951 - 1949 = 2 and prime(298) - prime(297) = 1973 - 1951 = 22 = 2*11.
		

Crossrefs

Programs

  • Maple
    nn:=50:m:=10^5:
    for n from 1 to 50 do:
    ii:=0:
      for k from 1 to m while(ii=0) do:
       p1:=ithprime(k):p2:=ithprime(k+1):p3:=ithprime(k+2):
        if p2-p1 = 2 and p3-p2 = 2*n
        then
        ii:=1:printf(`%d %d \n`,n,k):
        else
        fi:
       od:
        if ii=0 then printf(`%d %d \n`,n,0):
        else
        fi:
    od:
  • Mathematica
    Table[If[And[n > 1, Mod[n, 3] == 1], 0, k = 1; While[Nand[# - Prime@ k == 2, Prime[k + 2] - # == 2 n] &@ Prime[k + 1], k++]; k], {n, 40}] (* Michael De Vlieger, Jan 14 2017 *)

A305558 If (p1,p2) is the n-th twin prime pair and p the prime before p1 and q the prime after p2 then a(n) = p + q - (p1 + p2).

Original entry on oeis.org

1, 2, 0, 0, 0, 0, 0, 2, 0, 0, 4, -4, 4, -6, 8, 0, 4, 0, 6, 0, -6, 0, -4, 0, 6, 0, 0, 8, -6, 6, -2, -6, 6, 0, 0, 4, -4, 0, -4, 0, -12, 0, -14, 0, 0, -6, 0, 2, -6, 0, -2, 0, 20, 6, -2, 8, 0, 6, -2, 6, 0, 0, -8, 6, 4, -10, 6, -12, -12, 10, 0, 2, 0, 4, -6, 0, 2, 0, -6, 12, 22, -18, 6, 8, -18, 8, -22, 6, -2, 6, 0, 0, 18, -6
Offset: 1

Views

Author

Dimitris Valianatos, Jun 21 2018

Keywords

Examples

			For n = 8, the 8th prime pair is (71, 73), the prime before 71 is 67 and prime after 73 is 79. So a(8) = 67 + 79 - 71 - 73 = 2.
		

Crossrefs

Programs

  • Mathematica
    Map[#1 + #4 - (#2 + #3) & @@ # &, Select[Partition[Prime@ Range[500], 4, 1], And[#3 - #2 == 2] & @@ # &]] (* Michael De Vlieger, Jun 30 2018 *)
  • PARI
    {
    print1(2+7-(5+3)", ");
    forstep(n=6,100,6,
            if(isprime(n-1)&&isprime(n+1),
               a=precprime(n-2);b=nextprime(n+2);
               print1(a+b-2*n", ")
              )
           )
    }

Formula

a(n) = A000040(A029707(n)-1) + A000040(A107770(n)+1) - (A001359(n) + A006512(n)). - Jianing Song, Jun 22 2018

Extensions

Definition clarified by Jianing Song, Jun 22 2018

A320717 Indices of primes followed by a gap (distance to next larger prime) of 38.

Original entry on oeis.org

3302, 4052, 4154, 4743, 5093, 5229, 5782, 5902, 6131, 6406, 6802, 7145, 7164, 7399, 7718, 7789, 8303, 8782, 9237, 9957, 10073, 10431, 10465, 10541, 10549, 10580, 10981, 11244, 11818, 11853, 12147, 12574, 13094, 13237, 13286, 13337, 13435, 13669, 13906, 14186, 14270, 14301, 14380, 14397
Offset: 1

Views

Author

M. F. Hasler, Oct 19 2018

Keywords

Comments

Indices of the primes listed in A134118.

Crossrefs

Cf. A029707, A029709 (analog for gaps 2 & 4), A320701, A320702, ... A320720 (analog for gaps 6, 8, ..., 44), A116493 (gap 70), A116496 (gap 100), A116497 (gap 200), A116495 (gap 210).
Equals A000720 o A134118.
Indices of 38's in A001223.
Row 19 of A174349.

Programs

  • PARI
    A(N=100,g=38,p=2,i=primepi(p)-1,L=List())={forprime(q=1+p,,i++; if(p+g==p=q, listput(L,i); N--||break));Vec(L)} \\ returns the list of first N terms of the sequence

Formula

a(n) = A000720(A134118(n)).

A345366 a(n) = (p*q+1) mod (p+q) where p=prime(n) and q=prime(n+1).

Original entry on oeis.org

2, 0, 0, 6, 0, 12, 0, 18, 44, 0, 60, 36, 0, 42, 92, 104, 0, 120, 66, 0, 144, 78, 164, 78, 96, 0, 102, 0, 108, 192, 126, 260, 0, 264, 0, 300, 312, 162, 332, 344, 0, 348, 0, 192, 0, 170, 182, 222, 0, 228, 464, 0, 468, 500, 512, 524, 0, 540, 276, 0, 552, 552, 306
Offset: 1

Views

Author

Simon Strandgaard, Jun 16 2021

Keywords

Comments

The graph of this function consists of three branches: the upper one corresponds to cases where q-p == 2 (mod 4) except the twin primes, the middle one to cases where q-p == 0 (mod 4), and the lower one (where a(n)=0) to cases where q-p = 2, the twin primes.
All terms are even.

Examples

			a(1) = ( 2* 3+1) mod ( 2+ 3) =   7 mod  5 = 2,
a(2) = ( 3* 5+1) mod ( 3+ 5) =  16 mod  8 = 0,
a(3) = ( 5* 7+1) mod ( 5+ 7) =  36 mod 12 = 0,
a(4) = ( 7*11+1) mod ( 7+11) =  78 mod 18 = 6,
a(5) = (11*13+1) mod (11+13) = 144 mod 24 = 0.
		

Crossrefs

Cf. A000040, A212769, A029707 (indices of 0's).

Programs

  • Maple
    a:= n-> ((p, q)-> irem(p*q+1, p+q))(map(ithprime, [n, n+1])[]):
    seq(a(n), n=1..63);  # Alois P. Heinz, Jul 03 2021
  • Mathematica
    Mod[#1*#2 + 1, #1 + #2] & @@@ Partition[Select[Range[300], PrimeQ], 2, 1] (* Amiram Eldar, Jun 16 2021 *)
  • PARI
    a(n)=my(p=prime(n), q=nextprime(p+1)); (p*q+1)%(p+q)
    
  • Python
    from sympy import nextprime
    def aupton(nn):
        alst, p, q = [], 2, 3
        while len(alst) < nn: alst.append((p*q+1)%(p+q)); p, q = q, nextprime(q)
        return alst
    print(aupton(62)) # Michael S. Branicky, Jun 16 2021
  • Ruby
    require 'prime'
    values = []
    Prime.first(21).each_cons(2) do |a, b|
        values << (a * b + 1) % (a + b)
    end
    p values
    

Formula

a(n) = A023523(n+1) mod A001043(n). - Michel Marcus, Jun 17 2021

A373828 Run-sums (differing by 0) of run-lengths (differing by 2) of odd primes.

Original entry on oeis.org

3, 4, 1, 2, 1, 2, 2, 2, 1, 2, 4, 4, 3, 4, 4, 6, 2, 2, 1, 2, 3, 2, 1, 2, 2, 2, 3, 2, 10, 4, 4, 2, 7, 2, 4, 2, 3, 2, 2, 2, 1, 2, 2, 2, 18, 6, 2, 2, 2, 2, 17, 4, 1, 4, 2, 2, 6, 2, 9, 2, 3, 2, 1, 2, 1, 2, 1, 2, 8, 2, 3, 2, 2, 4, 15, 2, 1, 2, 4, 2, 1, 2, 1, 2, 7, 2
Offset: 1

Views

Author

Gus Wiseman, Jun 23 2024

Keywords

Comments

Run-sums of A251092.

Examples

			The odd primes are:
3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, ...
with runs:
{3,5,7}, {11,13}, {17,19}, {23}, {29,31}, {37}, {41,43}, {47}, {53}, ...
with lengths:
3, 2, 2, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 1, 1, 1, 2, 2, 1, 1, 1, 2, 2, ...
with runs:
{3}, {2,2}, {1}, {2}, {1}, {2}, {1,1}, {2}, {1}, {2}, {1,1,1,1}, {2,2}, ...
with sums a(n).
		

Crossrefs

Run-sums of A251092.
The run-lengths (instead of run-sums) are A373819, firsts A373825, A373824.
A000040 lists the primes.
A001223 gives first differences of primes.
A027833 gives antirun-lengths of primes > 3 (prepended run-lengths A373820).
A046933 counts composite numbers between primes.
A071148 gives partial sums of odd primes.
A333254 gives run-lengths of first differences of primes.
A373821 gives run-lengths of run-lengths of first differences of odd primes.

Programs

  • Mathematica
    Total/@Split[Length /@ Split[Select[Range[3,10000],PrimeQ], #1+2==#2&]//Most]//Most
Previous Showing 81-85 of 85 results.