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.

A258025 Numbers k such that prime(k+2) - 2*prime(k+1) + prime(k) > 0.

Original entry on oeis.org

1, 3, 5, 7, 8, 10, 13, 14, 17, 20, 22, 23, 26, 28, 29, 31, 33, 35, 38, 41, 43, 45, 49, 50, 52, 57, 60, 61, 64, 65, 67, 69, 70, 71, 75, 76, 78, 79, 81, 83, 85, 86, 89, 90, 93, 95, 96, 98, 100, 104, 105, 109, 113, 116, 117, 120, 122, 123, 124, 126, 131, 134
Offset: 1

Views

Author

Clark Kimberling, Jun 02 2015

Keywords

Examples

			5 - 2*3 + 2 = 1, so a(1) = 5.
		

Crossrefs

Partition of the positive integers: A064113, A258025, A258026;
Corresponding partition of the primes: A063535, A063535, A147812.
Adjacent terms differing by 1 correspond to weak prime quartets A054819.
The version for the Kolakoski sequence is A156243.
The version for strict descents is A258026.
The version for weak ascents is A333230.
The version for weak descents is A333231.
First differences are A333212 (if the first term is 0).
Prime gaps are A001223.
Positions of adjacent equal prime gaps are A064113.
Weakly decreasing runs of compositions in standard order are A124765.
A triangle counting compositions by strict ascents is A238343.
Positions of adjacent unequal prime gaps are A333214.
Lengths of maximal anti-runs of prime gaps are A333216.

Programs

  • Mathematica
    u = Table[Sign[Prime[n+2] - 2 Prime[n+1] + Prime[n]], {n, 3, 200}];
    Flatten[Position[u, 0]]   (* A064113 *)
    Flatten[Position[u, 1]]   (* A258025 *)
    Flatten[Position[u, -1]]  (* A258026 *)
    Accumulate[Length/@Split[Differences[Array[Prime,100]],#1>=#2&]]//Most (* Gus Wiseman, Mar 25 2020 *)
    Position[Partition[Prime[Range[150]],3,1],?(#[[3]]-2#[[2]]+#[[1]]> 0&),1,Heads->False]//Flatten (* _Harvey P. Dale, Dec 25 2021 *)
  • PARI
    isok(k) = prime(k+2) - 2*prime(k+1) + prime(k) > 0; \\ Michel Marcus, Jun 03 2015
    
  • PARI
    is(n,p=prime(n))=my(q=nextprime(p+1),r=nextprime(q+1)); p + r > 2*q
    v=List(); n=0; forprime(p=2,1e4, if(is(n++,p), listput(v,n))); v \\ Charles R Greathouse IV, Jun 03 2015
    
  • Python
    from itertools import count, islice
    from sympy import prime, nextprime
    def A258025_gen(startvalue=1): # generator of terms >= startvalue
        c = max(startvalue,1)
        p = prime(c)
        q = nextprime(p)
        r = nextprime(q)
        for k in count(c):
            if p+r>(q<<1):
                yield k
            p, q, r = q, r, nextprime(r)
    A258025_list = list(islice(A258025_gen(),20)) # Chai Wah Wu, Feb 27 2024

A258026 Numbers k such that prime(k+2) - 2*prime(k+1) + prime(k) < 0.

Original entry on oeis.org

4, 6, 9, 11, 12, 16, 18, 19, 21, 24, 25, 27, 30, 32, 34, 37, 40, 42, 44, 47, 48, 51, 53, 56, 58, 59, 62, 63, 66, 68, 72, 74, 77, 80, 82, 84, 87, 88, 91, 92, 94, 97, 99, 101, 103, 106, 108, 111, 112, 114, 115, 119, 121, 125, 127, 128, 130, 132, 133, 135, 137
Offset: 1

Views

Author

Clark Kimberling, Jun 05 2015

Keywords

Comments

Positions of strict descents in the sequence of differences between primes. Partial sums of A333215. - Gus Wiseman, Mar 24 2020

Examples

			The prime gaps split into the following maximal weakly increasing subsequences: (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), (2,4,14), ... Then a(n) is the n-th partial sum of the lengths of these subsequences. - _Gus Wiseman_, Mar 24 2020
		

Crossrefs

Partition of the positive integers: A064113, A258025, A258026;
Corresponding partition of the primes: A063535, A063535, A147812.
Adjacent terms differing by 1 correspond to strong prime quartets A054804.
The version for the Kolakoski sequence is A156242.
First differences are A333215 (if the first term is 0).
The version for strict ascents is A258025.
The version for weak ascents is A333230.
The version for weak descents is A333231.
Prime gaps are A001223.
Positions of adjacent equal prime gaps are A064113.
Weakly increasing runs of compositions in standard order are A124766.
Strictly decreasing runs of compositions in standard order are A124769.

Programs

  • Mathematica
    u = Table[Sign[Prime[n+2] - 2 Prime[n+1] + Prime[n]], {n, 1, 200}];
    Flatten[Position[u, 0]]   (* A064113 *)
    Flatten[Position[u, 1]]   (* A258025 *)
    Flatten[Position[u, -1]]  (* A258026 *)
    Accumulate[Length/@Split[Differences[Array[Prime,100]],LessEqual]]//Most (* Gus Wiseman, Mar 24 2020 *)
  • Python
    from itertools import count, islice
    from sympy import prime, nextprime
    def A258026_gen(startvalue=1): # generator of terms >= startvalue
        c = max(startvalue,1)
        p = prime(c)
        q = nextprime(p)
        r = nextprime(q)
        for k in count(c):
            if p+r<(q<<1):
                yield k
            p, q, r = q, r, nextprime(r)
    A258026_list = list(islice(A258026_gen(),20)) # Chai Wah Wu, Feb 27 2024
Showing 1-2 of 2 results.