login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A046933
Number of composites between successive primes.
118
0, 1, 1, 3, 1, 3, 1, 3, 5, 1, 5, 3, 1, 3, 5, 5, 1, 5, 3, 1, 5, 3, 5, 7, 3, 1, 3, 1, 3, 13, 3, 5, 1, 9, 1, 5, 5, 3, 5, 5, 1, 9, 1, 3, 1, 11, 11, 3, 1, 3, 5, 1, 9, 5, 5, 5, 1, 5, 3, 1, 9, 13, 3, 1, 3, 13, 5, 9, 1, 3, 5, 7, 5, 5, 3, 5, 7, 3, 7, 9, 1, 9, 1, 5, 3, 5, 7, 3, 1, 3, 11, 7, 3, 7, 3, 5, 11, 1, 17
OFFSET
1,4
COMMENTS
a(n) is odd for n>1 since all primes except 2 are odd. - Joel Brennan, Jan 02 2023
FORMULA
a(n) = prime(n+1) - prime(n) - 1 = A000040(n+1) - A000040(n) - 1.
a(n) = A001223(n) - 1.
a(n) = 2*A028334(n) - 1 for n>1. - Giovanni Teofilatto, Apr 19 2010
a(n) = Sum_{i=1..n-1} A036263(i). - Daniel Forgues, Apr 07 2014
EXAMPLE
a(1) = 0 since 2 is adjacent to 3;
a(2) = 1 since 4 is between 3 and 5;
a(4) = 3 = 11 - 7 - 1, etc.
MAPLE
A046933:=n->ithprime(n+1)-ithprime(n)-1; seq(A046933(n), n=1..100); # Wesley Ivan Hurt, Apr 15 2014
MATHEMATICA
Differences[Prime[Range[100]]] - 1 (* Arkadiusz Wesolowski, Nov 18 2011 *)
Table[Prime[n + 1] - Prime[n] - 1, {n, 100}] (* Wesley Ivan Hurt, Apr 15 2014 *)
Prepend[Drop[Length/@SequenceSplit[Range@Prime@100, {_?PrimeQ}], 1], 0] (* Federico Provvedi, Jul 19 2021 *)
PROG
(PARI) a(n)=prime(n+1)-prime(n)-1 \\ Charles R Greathouse IV, Nov 20 2012
(Haskell)
a046933 n = a046933_list !! (n-1)
a046933_list = map (subtract 1) a001223_list
-- Reinhard Zumkeller, Dec 12 2012
(Python)
from sympy import prime
def A046933(n): return prime(n+1)-prime(n)-1 # Chai Wah Wu, Jan 02 2024
CROSSREFS
Cf. A008996 (record values > 0).
Sequence in context: A066839 A372832 A176246 * A185091 A332031 A023511
KEYWORD
easy,nonn,nice
AUTHOR
Marc LeBrun, Dec 11 1999
STATUS
approved