OFFSET
1,2
LINKS
Amiram Eldar, Table of n, a(n) for n = 1..10000
FORMULA
Sum_{n>=1} 1/a(n) = 55/24.
EXAMPLE
6 is a term since 6 = 2^1 * 3^1 and the exponents of 2 and 3 are both odd: 1.
24 is a term since 24 = 2^3 * 3^1 and the exponents of 2 and 3 are both odd: 3 and 1, respectively.
MATHEMATICA
q[n_] := Module[{e = IntegerExponent[n, {2, 3}]}, (e[[1]] == 0 || OddQ[e[[1]]]) && (e[[2]] == 0 || OddQ[e[[2]]]) && Times@@({2, 3}^e) == n]; Select[Range[500000], q]
PROG
(PARI) is(n) = {my(e2 = valuation(n, 2), e3 = valuation(n, 3)); (e2 == 0 || e2%2) && (e3 == 0 || e3%2) && n == 2^e2 * 3^e3};
(Python)
from itertools import count, takewhile
def aupto(lim):
pows2 = list(takewhile(lambda x: x<lim, (2**i for i in count(1, 2))))
pows3 = list(takewhile(lambda x: x<lim, (3**i for i in count(1, 2))))
return sorted(c*d for c in [1]+pows2 for d in [1]+pows3 if c*d <= lim)
print(aupto(10**6)) # Michael S. Branicky, Jul 08 2022
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Amiram Eldar, Jul 08 2022
STATUS
approved