login
Nearest cube.
10

%I #26 Aug 15 2022 04:33:25

%S 0,1,1,1,1,8,8,8,8,8,8,8,8,8,8,8,8,8,27,27,27,27,27,27,27,27,27,27,27,

%T 27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,64,64,64,64,64,64,

%U 64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64

%N Nearest cube.

%C a(n) = if n-A048763(n) < A048762(n)-n then A048762(n) else A048763(n);

%C apart from 0, k^3 occurs 3*n^2+1 times, cf. A056107.

%H Reinhard Zumkeller, <a href="/A201053/b201053.txt">Table of n, a(n) for n = 0..10000</a>

%F G.f.: (1-x)^(-1)*Sum_{k>=0} (3*k^2+3*k+1)*x^((k+1)*(k^2+k/2+1)). - _Robert Israel_, Jan 03 2017

%F Sum_{n>=1} 1/a(n)^2 = Pi^4/30 + Pi^6/945. - _Amiram Eldar_, Aug 15 2022

%p seq(k^3 $ (3*k^2+1), k=0..10); # _Robert Israel_, Jan 03 2017

%t Module[{nn=70,c},c=Range[0,Ceiling[Surd[nn,3]]]^3;Flatten[Array[ Nearest[ c,#]&,nn,0]]] (* _Harvey P. Dale_, May 27 2014 *)

%o (Haskell)

%o a201053 n = a201053_list !! n

%o a201053_list = 0 : concatMap (\x -> replicate (a056107 x) (x ^ 3)) [1..]

%o (Python)

%o from sympy import integer_nthroot

%o def A201053(n):

%o a = integer_nthroot(n,3)[0]

%o return a**3 if 2*n < a**3+(a+1)**3 else (a+1)**3 # _Chai Wah Wu_, Mar 31 2021

%Y Cf. A061023, A074989, A053187 (nearest square), A000578.

%Y Cf. A048762, A048763, A056107.

%K nonn,look

%O 0,6

%A _Reinhard Zumkeller_, Nov 28 2011