OFFSET
1,4
COMMENTS
a(n) is odd for n>1 since all primes except 2 are odd. - Joel Brennan, Jan 02 2023
LINKS
T. D. Noe, Table of n, a(n) for n = 1..10000
FORMULA
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
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
KEYWORD
easy,nonn,nice
AUTHOR
Marc LeBrun, Dec 11 1999
STATUS
approved