cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A158038 Difference between n-th prime and next cube.

This page as a plain text file.
%I A158038 #20 Oct 19 2018 17:01:03
%S A158038 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,
%T A158038 24,22,18,16,12,89,85,79,77,67,65,59,53,49,43,37,35,25,23,19,17,5,120,
%U A158038 116,114,110,104,102,92,86,80,74,72,66,62,60,50,36,32,30,26,12,6,165,163
%N A158038 Difference between n-th prime and next cube.
%C A158038 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
%H A158038 M. F. Hasler, <a href="/A158038/b158038.txt">Table of n, a(n) for n = 1..1000</a>
%F A158038 a(n) > 0. - _David A. Corneth_, Oct 19 2018
%e A158038 The first terms are: 8 - 2 = 6, 8 - 3 = 5, 8 - 5 = 3, 8 - 7 = 1, 27 - 11 = 16, ...
%e A158038 From _M. F. Hasler_, Oct 19 2018: (Start)
%e A158038 Starting a new row when going to the next cube, the sequence reads:
%e A158038   6, 5, 3, 1,                      // = 8 - {primes between 1^3 = 1 and 2^3 = 8}
%e A158038   16, 14, 10, 8, 4,                // = 27 - {primes between 2^3 = 8 and 3^3 = 27}
%e A158038   35, 33, 27, 23, 21, 17, 11, 5, 3, // = 64 - {primes between 27 and 4^3 = 64}
%e A158038   58, 54, 52, ..., 18, 16, 12,     // = 125 - {primes between 64 and 5^3 = 125}
%e A158038   89, 85, 79, ..., 19, 17, 5,      // = 216 - {primes between 125 and 6^3 = 216}
%e A158038   120, 116, 114, ..., 26, 12, 6,   // = 343 - {primes between 216 and 7^3 = 343}
%e A158038   etc. (End)
%t A158038 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
%t A158038 nc[n_]:=(Floor[Surd[n,3]]+1)^3-n; Table[nc[n],{n,Prime[Range[70]]}] (* _Harvey P. Dale_, Jun 19 2014 *)
%o A158038 (PARI) A158038(n)=(sqrtnint(n=prime(n),3)+1)^3-n \\ _M. F. Hasler_, Oct 19 2018
%o A158038 (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
%Y A158038 Cf. A106044, A104492, A056892, A158037
%K A158038 nonn
%O A158038 1,1
%A A158038 _Vladimir Joseph Stephan Orlovsky_, Mar 11 2009
%E A158038 Edited by _M. F. Hasler_, Oct 19 2018