login
a(n) = phi(n) - ceiling(sqrt(n)).
7

%I #16 Sep 08 2022 08:45:08

%S 0,-1,0,0,1,-1,3,1,3,0,6,0,8,2,4,4,11,1,13,3,7,5,17,3,15,6,12,6,22,2,

%T 24,10,14,10,18,6,29,11,17,9,33,5,35,13,17,15,39,9,35,12,24,16,44,10,

%U 32,16,28,20,50,8,52,22,28,24,39,11,57,23,35,15,61,15,63,27,31,27,51,15,69,23,45

%N a(n) = phi(n) - ceiling(sqrt(n)).

%C a(n) >= 0 except for n = 2 and 6.

%D D. S. Mitrinovic et al., Handbook of Number Theory, Kluwer, p. 9.

%H G. C. Greubel, <a href="/A079530/b079530.txt">Table of n, a(n) for n = 1..10000</a>

%e a(6) = phi(6) - ceiling(sqrt(6)) = 2 - 3 = -1.

%p with(numtheory); A079530:=n->phi(n) - ceil(sqrt(n)); seq(A079530(k), k=1..100); # _Wesley Ivan Hurt_, Nov 01 2013

%t Table[EulerPhi[n] - Ceiling[Sqrt[n]], {n, 100}] (* _Wesley Ivan Hurt_, Nov 01 2013 *)

%o (PARI) a(n)=eulerphi(n)-sqrtint(n-1)-1 \\ _Charles R Greathouse IV_, Nov 01 2013

%o (Magma) [EulerPhi(n) - Ceiling(Sqrt(n)): n in [1..100]]; // _G. C. Greubel_, Jan 14 2019

%o (Sage) [euler_phi(n) - ceil(sqrt(n)) for n in (1..100)] # _G. C. Greubel_, Jan 14 2019

%o (Python)

%o from math import isqrt

%o from sympy import totient

%o def A079530(n): return totient(n)-1-isqrt(n-1) # _Chai Wah Wu_, Jul 28 2022

%Y Cf. A000010, A079531-A079534.

%K sign

%O 1,7

%A _N. J. A. Sloane_, Jan 23 2003