login
Number of numbers 0 <= i <= n such that i is a square or a cube (or both).
1

%I #21 Jun 25 2017 10:14:37

%S 1,2,2,2,3,3,3,3,4,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,7,7,8,8,8,8,8,8,8,

%T 8,8,9,9,9,9,9,9,9,9,9,9,9,9,9,10,10,10,10,10,10,10,10,10,10,10,10,10,

%U 10,10,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,13,13,13,13

%N Number of numbers 0 <= i <= n such that i is a square or a cube (or both).

%C Sixth powers are counted only once (0 and 1 are both squares and cubes, for example, but they are not counted twice).

%F a(n) = 1 + floor(n^(1/2)) + floor(n^(1/3)) - floor(n^(1/6)). - _N. J. A. Sloane_, Mar 16 2005

%e a(9)=5 because we have 0,1,4,8 and 9.

%p seq(1+floor(evalf(n^(1/2)))+floor(evalf(n^(1/3)))-floor(evalf(n^(1/6))),n=0..94); # _Emeric Deutsch_

%t Rest[Accumulate[Table[Which[IntegerQ[Sqrt[n]],1,IntegerQ[Surd[n,3]],1,True,0],{n,0,150}]]] (* _Harvey P. Dale_, Jun 24 2017 *)

%o (PARI) a(n)=sqrtint(n)+sqrtnint(n,3)-sqrtnint(n,6) \\ _Charles R Greathouse IV_, Jun 25 2017

%Y Cf. A104058.

%K easy,nonn

%O 0,2

%A _Giovanni Teofilatto_, Mar 02 2005

%E More terms from _Emeric Deutsch_, Mar 24 2005

%E Corrected by _Harvey P. Dale_, Jun 24 2017

%E Definition revised by _N. J. A. Sloane_, Jun 25 2017