%I #69 Nov 08 2024 06:17:25
%S 1,2,4,7,14,27,54,107,214,427,854,1706,3410,6815,13629,27259,54521,
%T 109042,218080,436158,872318,1744638,3489278,6978546,13957092,
%U 27914186,55828364,111656716,223313428,446626866,893253744,1786507472,3573014938,7146029910,14292059832
%N Number of cubefree integers not exceeding 2^n.
%C An alternate definition specifying "less than 2^n" would yield the same sequence except for the first 3 terms: 0,1,3,7,14,27,54,107, etc. (since powers of 2 beyond 8 are not cubefree).
%C The limit of a(n)/2^n is the inverse of Apery's constant, 1/zeta(3) [see A088453].
%H Chai Wah Wu, <a href="/A160113/b160113.txt">Table of n, a(n) for n = 0..103</a> (terms 0..80 from Gerard P. Michon)
%H Gerard P. Michon, <a href="http://www.numericana.com/answer/counting.htm#cubefree">On the number of cubefree integers not exceeding N</a>.
%F a(n) = Sum_{i=1..2^(n/3)} A008683(i)*floor(2^n/i^3).
%e a(0)=1 because there is just one cubefree integer (1) not exceeding 2^0 = 1.
%e a(3)=7 because 1,2,3,4,5,6,7 are cubefree but 8 is not.
%t a[n_] := Sum[ MoebiusMu[i]*Floor[2^n/i^3], {i, 1, 2^(n/3)}]; Table[a[n], {n, 0, 32}] (* _Jean-François Alcover_, Dec 20 2011, from formula *)
%t Module[{nn=20,mu},mu=Table[If[Max[FactorInteger[n][[All,2]]]<3,1,0],{n,2^nn}];Table[Total[Take[mu,2^k]],{k,0,nn}]] (* The program generates the first 20 terms of the sequence. To get more, increase the value (constant) for nn, but the program may take a long time to run. *) (* _Harvey P. Dale_, Aug 13 2021 *)
%o (Haskell)
%o a160113 = a060431 . (2 ^) -- _Reinhard Zumkeller_, Jul 27 2015
%o (Python)
%o from sympy import mobius, integer_nthroot
%o def A160113(n): return sum(mobius(k)*((1<<n)//k**3) for k in range(1, integer_nthroot(1<<n,3)[0]+1)) # _Chai Wah Wu_, Aug 06 2024
%o (Python)
%o from bitarray import bitarray
%o from sympy import integer_nthroot
%o def A160113(n): # faster program
%o q = 1<<n
%o m = integer_nthroot(q,3)[0]+1
%o a, b = bitarray(m), bitarray(m)
%o a[1], p, i, c = 1, 2, 4, q-sum(q//k**3 for k in range(2,m))
%o while i < m:
%o j = 2
%o while i < m:
%o if j==p:
%o c -= (b[i]^1 if a[i] else -1)*(q//i**3)
%o j, a[i], b[i] = 0, 1, 1
%o else:
%o t1, t2 = a[i], b[i]
%o if (t1&t2)^1:
%o a[i], b[i] = (t1^1)&t2, ((t1^1)&t2)^1
%o c += (t2 if t1 else 2)*(q//i**3) if (t1^1)&t2 else (t2-2 if t1 else 0)*(q//i**3)
%o i += p
%o j += 1
%o p += 1
%o while a[p]|b[p]:
%o p += 1
%o i = p<<1
%o return c # _Chai Wah Wu_, Aug 06 2024
%Y Cf. A004709 (cubefree numbers), A160112 (decimal counterpart for cubefree integers), A143658 (binary counterpart for squarefree integers), A071172 & A053462 (decimal counterpart for squarefree integers).
%Y Cf. A060431.
%K easy,nice,nonn
%O 0,2
%A _Gerard P. Michon_, May 02 2009