%I #81 Sep 16 2024 03:13:04
%S 1,2,3,4,4,5,5,6,7,7,7,8,8,8,8,9,9,10,10,10,10,10,10,11,11,11,12,12,
%T 12,12,12,13,13,13,13,14,14,14,14,14,14,14,14,14,14,14,14,15,15,15,15,
%U 15,15,16,16,16,16,16,16,16,16,16,16,17,17,17,17,17,17,17,17,18,18,18,18
%N Number of 3-smooth numbers <= n.
%C A 3-smooth number is a number of the form 2^x * 3^y where x >= 0 and y >= 0.
%D Bruce C. Berndt and Robert A. Rankin, "Ramanujan : letters and commentary", History of Mathematics Volume 9, AMS-LMS, p. 23, p. 35.
%D G. H. Hardy, Ramanujan: Twelve lectures on subjects suggested by his life and work, AMS Chelsea Pub., 1999, pages 67-82.
%H Reinhard Zumkeller, <a href="/A071521/b071521.txt">Table of n, a(n) for n = 1..10000</a>
%H Thierry Bousch, <a href="https://www.emis.de/journals/SLC/wpapers/s77bousch.html">La Tour de Stockmeyer</a>, Séminaire Lotharingien de Combinatoire 77 (2017), Article B77d.
%H M. Haussman and H. N. Shapiro, <a href="http://dx.doi.org/10.1002/cpa.3160420608">On Ramanujan right triangle conjecture</a>, Comm. Pure Appl. Math. 42 (1989), 885-889.
%H A. M. Ostrowski, <a href="http://dx.doi.org/10.1007/BF02940581">Bemerkungen zur Theorie der Diophantischen Approximationen</a>, Abh. Math. Sem. Univ. Hamburg 1 (1922), 77-98; 250-251.
%H Raphael Schumacher, <a href="https://arxiv.org/abs/1608.06928">The Formulas for the Distribution of the 3-Smooth, 5-Smooth, 7-Smooth and all other Smooth Numbers</a>, arXiv preprint arXiv:1608.06928 [math.NT], 2016.
%F a(n) = Card{ k | A003586(k) <= n }. Asymptotically: let a=1/(2*log(2)*log(3)), b=sqrt(6), then from Ramanujan a(n) ~ a*log(2*n)*log(3*n) or equivalently a(n) ~ a*log(b*n)^2.
%F A022331(n) = a(A000079(n)); A022330(n) = a(A000244(n)). - _Reinhard Zumkeller_, May 09 2006
%F a(n) = Sum_{k=1..n} mu(6k)*floor(n/k). - _Benoit Cloitre_, Jun 14 2007
%F a(n) = Sum_{k=1..n} (floor(6^k/k)-floor((6^k-1)/k)). - _Anthony Browne_, May 19 2016
%F From _Ridouane Oudra_, Jul 17 2020: (Start)
%F a(n) = Sum_{i=0..floor(log_2(n))} (floor(log_3(n/2^i)) + 1).
%F a(n) = Sum_{i=0..floor(log_3(n))} (floor(log_2(n/3^i)) + 1). (End)
%F A322026(n) = a(A065331(n)). - _Antti Karttunen_, Sep 08 2024
%p N:= 10000: # to get a(1) to a(N)
%p V:= Vector(N):
%p for y from 0 to floor(log[3](N)) do
%p for x from 0 to ilog2(N/3^y) do
%p V[2^x*3^y]:= 1
%p od od:
%p convert(map(round,Statistics:-CumulativeSum(V)),list); # _Robert Israel_, Dec 16 2014
%t a[n_] := Sum[ MoebiusMu[6k]*Floor[n/k], {k, 1, n}]; Table[a[n], {n, 1, 75}] (* _Jean-François Alcover_, Oct 11 2011, after _Benoit Cloitre_ *)
%t f[n_] := Sum[Floor@Log[3, n/2^i] + 1, {i, 0, Log[2, n]}]; Array[f, 75] (* faster, or *)
%t f[n_] := Sum[Floor@Log[2, n/3^i] + 1, {i, 0, Log[3, n]}]; Array[f, 75] (* _Robert G. Wilson v_, Aug 18 2012 *)
%t Accumulate[Table[If[Max[FactorInteger[n][[All,1]]]<4,1,0],{n,80}]] (* _Harvey P. Dale_, Jan 11 2017 *)
%o (PARI) for(n=1,100,print1(sum(k=1,n,if(sum(i=3,n,if(k%prime(i),0,1)),0,1)),","))
%o (PARI) a(n)=sum(k=1,n,moebius(2*3*k)*floor(n/k)) \\ _Benoit Cloitre_, Jun 14 2007
%o (PARI) a(n)=my(t=1/3); sum(k=0,logint(n,3), t*=3; logint(n\t,2)+1) \\ _Charles R Greathouse IV_, Jan 08 2018
%o (Haskell)
%o a071521 n = length $ takeWhile (<= n) a003586_list
%o -- _Reinhard Zumkeller_, Aug 14 2011
%o (Python)
%o from sympy import integer_log
%o def A071521(n): return sum((n//3**i).bit_length() for i in range(integer_log(n,3)[0]+1)) # _Chai Wah Wu_, Sep 15 2024
%Y Cf. A003586.
%Y Cf. A000079, A000244, A022330, A022331, A065331, A322026.
%K easy,nice,nonn
%O 1,2
%A _Benoit Cloitre_, Jun 02 2002