A137330 a(n) = primorial(k) - prime(n) where k is the smallest number for which prime(n) <= primorial(k).
0, 3, 1, 23, 19, 17, 13, 11, 7, 1, 179, 173, 169, 167, 163, 157, 151, 149, 143, 139, 137, 131, 127, 121, 113, 109, 107, 103, 101, 97, 83, 79, 73, 71, 61, 59, 53, 47, 43, 37, 31, 29, 19, 17, 13, 11, 2099, 2087, 2083, 2081, 2077, 2071, 2069, 2059, 2053, 2047, 2041
Offset: 1
Examples
a(6) = primorial(3) - prime(6) = 30-13 = 17.
Links
- Michael De Vlieger, Table of n, a(n) for n = 1..10000
Programs
-
Mathematica
Block[{a = {}, P = 2, j = 1}, Do[AppendTo[a, If[# > P, j++; P *= Prime[j], P] - #] &@ Prime[n], {n, 57}]; a] (* Michael De Vlieger, Dec 07 2020 *)
-
PARI
a(n) = {my(pp=2, k=1, p=prime(n)); while (pp < p, k++; pp*=prime(k)); pp-p;} \\ Michel Marcus, Dec 06 2020
Comments