A010057 a(n) = 1 if n is a cube, else 0.
1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
Offset: 0
References
- E. Landau, Elementary Number Theory, translation by Jacob E. Goodman of Elementare Zahlentheorie (Vol. I_1 (1927) of Vorlesungen ueber Zahlentheorie), by Edmund Landau, with added exercises by Paul T. Bateman and E. E. Kohlbecker, Chelsea Publishing Co., New York, 1958, pp. 31-32.
Links
- Reinhard Zumkeller, Table of n, a(n) for n = 0..10000
- Index entries for characteristic functions
Crossrefs
Cf. A000578.
Cf. A003215. - Reinhard Zumkeller, Sep 27 2008
Programs
-
Haskell
a010057 0 = 1 a010057 n = fromEnum $ all ((== 0) . (`mod` 3)) $ a124010_row n a010057_list = concatMap (\x -> 1 : replicate (a003215 x - 1) 0) [0..] -- Reinhard Zumkeller, Jun 21 2013, Oct 22 2011
-
Maple
A010057 := proc(n) if n = 0 then 1; else for pe in ifactors(n)[2] do if modp(op(2,pe),3) <> 0 then return 0 ; end if; end do: end if; 1 ; end proc: # R. J. Mathar, Feb 07 2023
-
Mathematica
Table[ Boole[ IntegerQ[n^(1/3)]], {n, 0, 80}] (* Jean-François Alcover, Jun 10 2013 *)
-
PARI
a(n) = ispower(n, 3); \\ Michel Marcus, Feb 24 2015
-
Python
from sympy import integer_nthroot def A010057(n): return int(integer_nthroot(n,3)[1]) # Chai Wah Wu, Apr 02 2021
Formula
Dirichlet generating function: zeta(3s). - Franklin T. Adams-Watters, Sep 11 2005
a(n) = f(n,0) with f(x,y) = if x>0 then f(x-3*y*(y+1),y+1) else 0^(-x). - Reinhard Zumkeller, Sep 27 2008
a(n) = 1 + floor(n^(1/3)) - ceiling(n^(1/3)). - Wesley Ivan Hurt, Jun 06 2014
a(n) = floor(n^(1/3)) - floor((n-1)^(1/3)). - Mikael Aaltonen, Feb 24 2015
Comments