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

A066485 Numbers n such that f(n) is a strict local extremum for the prime gaps function f(n) = prime(n+1)-prime(n), where prime(n) denotes the n-th prime; i.e., either f(n)>f(n-1) and f(n)>f(n+1) or f(n)

Original entry on oeis.org

4, 5, 6, 7, 9, 10, 11, 13, 17, 18, 20, 21, 22, 24, 26, 27, 28, 30, 31, 32, 33, 34, 35, 38, 41, 42, 43, 44, 45, 49, 51, 52, 53, 57, 58, 60, 62, 64, 66, 67, 68, 69, 72, 75, 77, 78, 80, 81, 82, 83, 84, 85, 87, 89, 91, 93, 94, 95, 97, 98, 99, 100, 101, 104, 106, 109, 113, 114
Offset: 1

Views

Author

Joseph L. Pe, Jan 02 2002

Keywords

Comments

Call a finite subsequence of consecutive terms of a(n) a "zigzag" if it consists of consecutive integers; for example, 30, 31, 32, 33, 34, 35 is a zigzag. Are there zigzags of arbitrary length? (Cf. A066918.)

Examples

			4 is a term since f(4) is a local maximum: f(3)=2, f(4)=4, f(5)=2.
		

Crossrefs

Cf. A198696 (local maxima), A196174 (local minima).

Programs

  • Maple
    Primes:= select(isprime,[2,seq(2*i+1,i=1..10^3)]):
    G:= Primes[2..-1] - Primes[1..-2]:
    select(n -> G[n] > max(G[n-1],G[n+1]) or G[n] < min(G[n-1],G[n+1]), [$2..nops(G)-1]):
    # Robert Israel, Sep 20 2015
  • Mathematica
    f[n_] := Prime[n+1]-Prime[n]; Select[Range[200], (f[ # ]-f[ #-1])(f[ # ]-f[ #+1])>0&]
  • PARI
    f(n) = prime(n+1)-prime(n);
    isok(n) = if (n>2, my(x=f(n), y=f(n-1), z=f(n+1)); ((x>y) && (x>z)) || ((xMichel Marcus, Mar 26 2020

Extensions

Edited by Dean Hickerson, Jun 26 2002

A198697 Values of local maxima in differences of primes, A001223.

Original entry on oeis.org

4, 4, 6, 6, 6, 6, 8, 4, 14, 6, 10, 10, 4, 6, 10, 6, 14, 14, 10, 8, 8, 10, 10, 6, 8, 12, 8, 12, 18, 10, 10, 12, 12, 10, 10, 8, 8, 14, 12, 10, 4, 14, 14, 20, 10, 14, 8, 12, 6, 10, 10, 10, 18, 8, 22, 10, 10, 12, 12, 18, 6, 6, 12, 34, 18, 14, 8, 12, 4, 12, 8, 8
Offset: 1

Views

Author

Zak Seidov, Oct 29 2011

Keywords

Crossrefs

Cf. A198696 (positions of local maxima in A001223).
Cf. A196175 (positions of local minima in A001223).
Cf. A001223 (first differences of primes).

Programs

  • Maple
    P:= select(isprime,[2,seq(i,i=3..1000,2)]):
    DP:= P[2..-1] - P[1..-2]:
    J:= select(t -> DP[t] > DP[t-1] and DP[t] > DP[t+1], [$2..nops(DP)-1]):
    DP[J]; # Robert Israel, Mar 07 2024
  • 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][[2]] (* T. D. Noe, Dec 27 2011 *)
    Select[Partition[Differences[Prime[Range[400]]],3,1],#[[1]]<#[[2]]>#[[3]]&][[;;,2]] (* Harvey P. Dale, Mar 07 2023 *)

A385466 Primes that are at the end of the local maxima in the sequence of consecutive prime gaps.

Original entry on oeis.org

11, 17, 29, 37, 67, 79, 97, 107, 127, 137, 149, 191, 197, 239, 251, 277, 307, 331, 347, 367, 397, 419, 431, 439, 457, 479, 499, 521, 541, 557, 587, 631, 673, 701, 719, 751, 769, 787, 809, 821, 827, 853, 877, 907, 929, 967, 991, 1009, 1019, 1031, 1049, 1061, 1087
Offset: 1

Views

Author

Emirhan Üçok, Jun 29 2025

Keywords

Comments

This sequence lists the larger prime in each consecutive prime pair where the difference is a local maximum in the sequence of prime gaps.
A local maximum occurs when p(n)-p(n-1) < p(n+1)-p(n) > p(n+2)-p(n+1) where p(n) is the n-th prime.

Examples

			The primes 7 and 11 differ by 4, which is larger than the previous gap (2) and the next gap (2). So 11 is in the sequence.
		

Crossrefs

Cf. A001223 (prime gaps), A198696.

Programs

  • Mathematica
    Module[{primes = Prime[Range[1, 200]], diffs, res = {}}, diffs = Differences[primes];
    Do[If[diffs[[i]] > diffs[[i - 1]] && diffs[[i]] > diffs[[i + 1]],
    AppendTo[res, primes[[i + 1]]]], {i, 2, Length[diffs] - 1}]; res]
  • Python
    from sympy import primerange
    primes = list(primerange(2, 2000))
    diffs = [primes[i+1] - primes[i] for i in range(len(primes)-1)]
    local_max_asals = []
    for i in range(1, len(diffs)-1):
        if diffs[i] > diffs[i-1] and diffs[i] > diffs[i+1]:
            local_max_asals.append(primes[i+1])
    print(local_max_asals[:70])

Formula

a(n) = prime(A198696(n)+1). - Michel Marcus, Jul 01 2025
Showing 1-3 of 3 results.