login
A371282
a(1)=1; for n>1, a(n) = a(n-1) * k or a(n-1) - k to give the smallest, distinct positive integer, where each k can be used only once.
2
1, 2, 6, 5, 20, 3, 15, 4, 24, 8, 56, 7, 63, 9, 72, 10, 100, 11, 132, 12, 156, 13, 182, 14, 210, 16, 288, 17, 323, 18, 360, 19, 399, 21, 462, 22, 506, 23, 552, 25, 625, 26, 676, 27, 729, 28, 784, 29, 841, 30, 900, 31, 961, 32, 1024, 33, 1089, 34, 1156, 35, 1225
OFFSET
1,2
COMMENTS
The sequence is a permutation of the positive integers.
LINKS
PROG
(Python)
from itertools import islice
def agen(): # generator of terms
mina, an, aset, mink, kset = 1, 1, {1}, 1, set()
while True:
yield an
k1, ak1, k2 = 0, mina, mink
if mina < an:
for ak1 in range(mina, an-mink+1):
if ak1 not in aset and an - ak1 not in kset:
k1 = an - ak1
break
while k2 in kset or an*k2 in aset:
k2 += 1
an, k = (an-k1, k1) if k1 > 0 else (an*k2, k2)
aset.add(an)
kset.add(k)
while mina in aset: mina += 1
while mink in kset: mink += 1
print(list(islice(agen(), 61))) # Michael S. Branicky, Mar 18 2024
CROSSREFS
Cf. A371295 (k values), A081145 (add or subtract), A084337 (multiply or divide).
Sequence in context: A085205 A094595 A182830 * A280530 A281280 A281179
KEYWORD
nonn
AUTHOR
Neal Gersh Tolunsky, Mar 17 2024
EXTENSIONS
a(13) and beyond from Michael S. Branicky, Mar 18 2024
STATUS
approved