login
Difference between 2n and the n-th squarefree number: a(n) = 2n - A005117(n).
4

%I #19 Aug 13 2024 02:13:13

%S 1,2,3,3,4,5,4,5,5,6,7,7,7,7,8,9,8,7,8,9,9,10,11,11,12,13,13,14,15,14,

%T 15,13,13,13,13,14,15,15,16,15,16,17,17,18,19,19,20,19,20,21,20,21,21,

%U 22,23,23,23,23,24,25,25,23,24,25,25,26,27,27,28,29,29,30

%N Difference between 2n and the n-th squarefree number: a(n) = 2n - A005117(n).

%H Antti Karttunen, <a href="/A243351/b243351.txt">Table of n, a(n) for n = 1..10001</a>

%F a(n) = 2n - A005117(n).

%F a(n) = n - A243348(n).

%F a(n) ~ c * n, where c = 2 - Pi^2/6 (A152416). - _Amiram Eldar_, Mar 04 2024

%t Module[{sf=Select[Range[150],SquareFreeQ]},Table[2n-sf[[n]],{n,Length[ sf]}]] (* _Harvey P. Dale_, Jun 26 2021 *)

%o (Python)

%o from math import isqrt

%o from sympy import mobius

%o def A243351(n):

%o def f(x): return n+x-sum(mobius(k)*(x//k**2) for k in range(1, isqrt(x)+1))

%o m, k = n, f(n)

%o while m != k:

%o m, k = k, f(k)

%o return (n<<1)-m # _Chai Wah Wu_, Aug 12 2024

%Y Cf. A005117, A152416, A243348.

%K nonn

%O 1,2

%A _Antti Karttunen_, Jun 04 2014