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
M. F. Hasler, Table of n, a(n) for n = 1..1000
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
Vladimir Joseph Stephan Orlovsky, Mar 11 2009
EXTENSIONS
Edited by M. F. Hasler, Oct 19 2018
STATUS
approved