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.

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) and f(n)

This page as a plain text file.
%I A066485 #20 Oct 22 2023 16:04:42
%S A066485 4,5,6,7,9,10,11,13,17,18,20,21,22,24,26,27,28,30,31,32,33,34,35,38,
%T A066485 41,42,43,44,45,49,51,52,53,57,58,60,62,64,66,67,68,69,72,75,77,78,80,
%U A066485 81,82,83,84,85,87,89,91,93,94,95,97,98,99,100,101,104,106,109,113,114
%N 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)<f(n-1) and f(n)<f(n+1).
%C A066485 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.)
%H A066485 Robert Israel, <a href="/A066485/b066485.txt">Table of n, a(n) for n = 1..10000</a>
%e A066485 4 is a term since f(4) is a local maximum: f(3)=2, f(4)=4, f(5)=2.
%p A066485 Primes:= select(isprime,[2,seq(2*i+1,i=1..10^3)]):
%p A066485 G:= Primes[2..-1] - Primes[1..-2]:
%p A066485 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]):
%p A066485 # _Robert Israel_, Sep 20 2015
%t A066485 f[n_] := Prime[n+1]-Prime[n]; Select[Range[200], (f[ # ]-f[ #-1])(f[ # ]-f[ #+1])>0&]
%o A066485 (PARI) f(n) = prime(n+1)-prime(n);
%o A066485 isok(n) = if (n>2, my(x=f(n), y=f(n-1), z=f(n+1)); ((x>y) && (x>z)) || ((x<y) && (x<z))); \\ _Michel Marcus_, Mar 26 2020
%Y A066485 Cf. A066918, A001223.
%Y A066485 Cf. A198696 (local maxima), A196174 (local minima).
%K A066485 nonn
%O A066485 1,1
%A A066485 _Joseph L. Pe_, Jan 02 2002
%E A066485 Edited by _Dean Hickerson_, Jun 26 2002