login
If n is a cube, replace it with the cube root of n.
2

%I #21 Jul 07 2024 08:01:15

%S 0,1,2,3,4,5,6,7,2,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,

%T 26,3,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,

%U 49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,4,65,66,67,68,69,70,71,72,73,74

%N If n is a cube, replace it with the cube root of n.

%F Sum_{n>=1} (-1)^(n+1)/n = 2*log(2) - 3*zeta(3)/4 = A016627 - A197070. - _Amiram Eldar_, Jul 07 2024

%e The 9th integer is 8 so a(9) = 8^(1/3) = 2.

%t rcr[n_]:=Module[{crn=Power[n, (3)^-1]},If[IntegerQ[crn],crn,n]]; Array[ rcr,80,0] (* _Harvey P. Dale_, Jan 28 2012 *)

%o (PARI) iscube(n) = { local(r); r = n^(1/3); if(floor(r+.5)^3== n,1,0) }

%o replcube(n) = { for(x=0,n, if(iscube(x),y=x^(1/3),y=x); print1(floor(y)",")) }

%o (PARI) a(n)=ispower(n,3,&n);n \\ _Charles R Greathouse IV_, Oct 27 2011

%Y Cf. A016627, A097448, A197070.

%K nonn,easy

%O 0,3

%A _Cino Hilliard_, Aug 23 2004

%E Corrected by _T. D. Noe_, Oct 25 2006