login
A158038
Difference between n-th prime and next cube.
2
6, 5, 3, 1, 16, 14, 10, 8, 4, 35, 33, 27, 23, 21, 17, 11, 5, 3, 58, 54, 52, 46, 42, 36, 28, 24, 22, 18, 16, 12, 89, 85, 79, 77, 67, 65, 59, 53, 49, 43, 37, 35, 25, 23, 19, 17, 5, 120, 116, 114, 110, 104, 102, 92, 86, 80, 74, 72, 66, 62, 60, 50, 36, 32, 30, 26, 12, 6, 165, 163
OFFSET
1,1
COMMENTS
Could be read as a table, since there are always several primes between two cubes. Whenever a(n+1) > a(n), the n-th prime is the largest one below a given cube and prime(n+1) is the smallest prime larger than that cube. For n > 1, these are also the indices where the parity of the terms changes. - M. F. Hasler, Oct 19 2018
LINKS
FORMULA
a(n) > 0. - David A. Corneth, Oct 19 2018
EXAMPLE
The first terms are: 8 - 2 = 6, 8 - 3 = 5, 8 - 5 = 3, 8 - 7 = 1, 27 - 11 = 16, ...
From M. F. Hasler, Oct 19 2018: (Start)
Starting a new row when going to the next cube, the sequence reads:
6, 5, 3, 1, // = 8 - {primes between 1^3 = 1 and 2^3 = 8}
16, 14, 10, 8, 4, // = 27 - {primes between 2^3 = 8 and 3^3 = 27}
35, 33, 27, 23, 21, 17, 11, 5, 3, // = 64 - {primes between 27 and 4^3 = 64}
58, 54, 52, ..., 18, 16, 12, // = 125 - {primes between 64 and 5^3 = 125}
89, 85, 79, ..., 19, 17, 5, // = 216 - {primes between 125 and 6^3 = 216}
120, 116, 114, ..., 26, 12, 6, // = 343 - {primes between 216 and 7^3 = 343}
etc. (End)
MATHEMATICA
lst={}; Do[p=Prime[n]; s=p^(1/3); f=Floor[s]; a=(f+1)^3; d=a-p; AppendTo[lst, d], {n, 6!}]; lst
nc[n_]:=(Floor[Surd[n, 3]]+1)^3-n; Table[nc[n], {n, Prime[Range[70]]}] (* Harvey P. Dale, Jun 19 2014 *)
PROG
(PARI) A158038(n)=(sqrtnint(n=prime(n), 3)+1)^3-n \\ M. F. Hasler, Oct 19 2018
(PARI) first(n) = my(res = vector(n), t = 0, c = 2, c3 = 8); forprime(p = 2, oo, t++; if(p > c3, c++; c3 = c^3); res[t] = c3 - p; if(t==n, return(res))) \\ David A. Corneth, Oct 19 2018
CROSSREFS
KEYWORD
nonn
AUTHOR
EXTENSIONS
Edited by M. F. Hasler, Oct 19 2018
STATUS
approved