This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A003594 #63 Jul 06 2025 10:34:01 %S A003594 1,3,7,9,21,27,49,63,81,147,189,243,343,441,567,729,1029,1323,1701, %T A003594 2187,2401,3087,3969,5103,6561,7203,9261,11907,15309,16807,19683, %U A003594 21609,27783,35721,45927,50421,59049,64827,83349,107163,117649 %N A003594 Numbers of the form 3^i*7^j with i, j >= 0. %H A003594 Reinhard Zumkeller, <a href="/A003594/b003594.txt">Table of n, a(n) for n = 1..10000</a> (first 70 terms from Vincenzo Librandi) %H A003594 Vaclav Kotesovec, <a href="/A003594/a003594.jpg">Graph - the asymptotic ratio (600000 terms)</a>. %F A003594 The characteristic function of this sequence is given by Sum_{n >= 1} x^a(n) = Sum_{n >= 1} mu(21*n)*x^n/(1 - x^n), where mu(n) is the Möbius function A008683. Cf. with the formula of Hanna in A051037. - _Peter Bala_, Mar 18 2019 %F A003594 Sum_{n>=1} 1/a(n) = (3*7)/((3-1)*(7-1)) = 7/4. - _Amiram Eldar_, Sep 22 2020 %F A003594 a(n) ~ exp(sqrt(2*log(3)*log(7)*n)) / sqrt(21). - _Vaclav Kotesovec_, Sep 22 2020 %F A003594 a(n) = 3^A025642(n) * 7^A025665(n). - _R. J. Mathar_, Jul 06 2025 %t A003594 f[upto_]:=Sort[Select[Flatten[3^First[#] 7^Last[#] & /@ Tuples[{Range[0, Floor[Log[3, upto]]], Range[0, Floor[Log[7, upto]]]}]], # <= upto &]]; f[120000] (* _Harvey P. Dale_, Mar 04 2011 *) %t A003594 fQ[n_] := PowerMod[21, n, n] == 0; Select[Range[120000], fQ] (* _Bruno Berselli_, Sep 24 2012 *) %o A003594 (PARI) list(lim)=my(v=List(),N);for(n=0,log(lim)\log(7),N=7^n;while(N<=lim,listput(v,N);N*=3));vecsort(Vec(v)) \\ _Charles R Greathouse IV_, Jun 28 2011 %o A003594 (Magma) [n: n in [1..120000] | PrimeDivisors(n) subset [3,7]]; // _Bruno Berselli_, Sep 24 2012 %o A003594 (Haskell) %o A003594 import Data.Set (singleton, deleteFindMin, insert) %o A003594 a003594 n = a003594_list !! (n-1) %o A003594 a003594_list = f $ singleton 1 where %o A003594 f s = y : f (insert (3 * y) $ insert (7 * y) s') %o A003594 where (y, s') = deleteFindMin s %o A003594 -- _Reinhard Zumkeller_, May 16 2015 %o A003594 (GAP) Filtered([1..120000],n->PowerMod(21,n,n)=0); # _Muniru A Asiru_, Mar 19 2019 %o A003594 (Python) %o A003594 from sympy import integer_log %o A003594 def A003594(n): %o A003594 def bisection(f,kmin=0,kmax=1): %o A003594 while f(kmax) > kmax: kmax <<= 1 %o A003594 while kmax-kmin > 1: %o A003594 kmid = kmax+kmin>>1 %o A003594 if f(kmid) <= kmid: %o A003594 kmax = kmid %o A003594 else: %o A003594 kmin = kmid %o A003594 return kmax %o A003594 def f(x): return n+x-sum(integer_log(x//7**i,3)[0]+1 for i in range(integer_log(x,7)[0]+1)) %o A003594 return bisection(f,n,n) # _Chai Wah Wu_, Sep 16 2024 %Y A003594 Cf. A003586, A003591, A003592, A003593, A003595. %Y A003594 Cf. A025642, A025665. %K A003594 nonn %O A003594 1,2 %A A003594 _N. J. A. Sloane_