OFFSET
1,2
COMMENTS
The definition implies that if n is not a power of 2, then neither is a(n).
Similar to the Doudna sequence (A005940), except that here the multiple of a(k) used to compute a(n) is the least odd number (rather than the least odd prime), such that a(n) is a novel term. Terms are the same as in A005940 until a(49)=99 (instead of 121), subsequent to which further odd nonprime multiples produce more differences from A005940; the next is a(71)=117 (instead of 99).
A permutation of the positive integers, in which the primes appear in natural order, but the odd numbers do not (9 precedes 7, 25 precedes 21, etc.).
LINKS
FORMULA
a(2^n + 1) is the smallest odd number which has not already occurred.
EXAMPLE
n = 49 = 2^5 + 17, and a(17) = 11, so a(49) is the least m*a(17) which has not occurred earlier, where m is an odd number. Up to this point we have seen 3*11, 5*11, 7*11, but not 9*11. Therefore a(49) = 9*11 = 99 (compare with A005940(71)=99).
MATHEMATICA
nn = 65; m = 1; c[_] = False; Do[Set[{m, k}, {1, n - 2^Floor[Log2[n]]}]; If[k == 0, Set[{a[n], c[n]}, {n, True}], While[Set[t, m a[k]]; Or[m == 1, c[t]], m += 2]; Set[{a[n], c[t]}, {t, True}]], {n, nn}]; Array[a, nn] (* Michael De Vlieger, Sep 21 2022 *)
PROG
(Python)
from sympy import nextprime
from sympy.ntheory import digits
from itertools import count, islice
def b(n): return n - 2**(len(bin(n)[2:]) - 1)
def agen():
aset, alst = set(), [None]
for n in count(1):
k = b(n)
if k == 0: an = n
else:
ak, p = alst[k], 3
while p*ak in aset: p += 2
an = p*ak
yield an; aset.add(an); alst.append(an)
print(list(islice(agen(), 65))) # Michael S. Branicky, Sep 21 2022
(PARI) f(n) = n - 2^(logint(n, 2)); \\ A053645
lista(nn) = {my(va = vector(nn), sa = Set(va)); for (n=1, nn, my(x = f(n)); if (x == 0, va[n] = n, my(k=1); while (setsearch(sa, k*va[x]), k+=2); va[n] = k*va[x]; ); sa = Set(va); ); va; } \\ Michel Marcus, Sep 27 2022
CROSSREFS
KEYWORD
nonn
AUTHOR
David James Sycamore, Sep 21 2022
STATUS
approved