OFFSET
1,2
COMMENTS
This is a permutation of the integers > 0 (as the prime numbers are multiples of 1).
LINKS
EXAMPLE
The first d is 1; as 1 is already in the sequence, we extend it with 2;
the next d is now 2; as 2 is already in the sequence, we extend it with 4 (smallest multiple of 2 not in the sequence);
the next d is 4; as 4 is already in the sequence, we extend it with 8 (smallest multiple);
the next d is 8; as 8 is already in the sequence, we extend it with 16 (smallest multiple);
the next d is 1; we extend the sequence with 3 as 3 is the smallest multiple of 1 not yet present in the sequence;
the next d is 6; as 6 is not yet present, we extend the sequence with 6;
the next d is 3; we extend the sequence with 9 as 9 is the smallest multiple of 3 not yet present;
the next d is 6; we extend the sequence with 12 as 12 is the smallest multiple of 6 not yet present; etc.
As the zero of 10 will not be read, we will extend the sequence at that point with the smallest multiple of 7 not yet present -- which is 14.
PROG
(Python)
def aupto(n):
alst, astr, used, strind = [1], "1", {1}, 0
for k in range(1, n):
while astr[strind] == "0": strind += 1
ak = digit = int(astr[strind])
while ak in used: ak += digit
alst.append(ak); astr += str(ak); used.add(ak); strind += 1
return alst # use alst[n-1] for a(n)
print(aupto(71)) # Michael S. Branicky, Dec 19 2020
CROSSREFS
KEYWORD
base,nonn
AUTHOR
Eric Angelini and Carole Dubois, Dec 19 2020
STATUS
approved