A375719 a(1) = 1; For n > 1, a(n) is the smallest number different from a(1), ..., a(n-1) such that lcm(a(1), ..., a(n)) is a perfect square.
1, 4, 2, 9, 3, 6, 12, 16, 8, 18, 24, 25, 5, 10, 15, 20, 30, 36, 40, 45, 48, 49, 7, 14, 21, 28, 35, 42, 50, 56, 60, 63, 64, 32, 70, 72, 75, 80, 81, 27, 54, 84, 90, 96, 98, 100, 105, 108, 112, 120, 121, 11, 22, 33, 44, 55, 66, 77, 88, 99, 110, 126, 132, 135, 140
Offset: 1
Examples
For n = 4, a(4) is different from 1, 2, 4, and lcm(4, a(4)) is a perfect square. Therefore, a(4) = 9.
Links
Programs
-
PARI
seq(n)={my(b=1, a=vector(n), M=Map()); for(n=1, #a, my(k=1); while(!issquare(lcm(b,k)) || mapisdefined(M,k), k++); a[n]=k; b=lcm(b,k); mapput(M,k,1)); a} \\ Andrew Howroyd, Aug 30 2024
-
Python
from math import isqrt, lcm from itertools import count, islice def sqr(n): return isqrt(n)**2 == n def agen(): # generator of terms an, aset, L, m = 1, {1}, 1, 2 for n in count(2): yield an an = next(k for k in count(m) if k not in aset and sqr(lcm(k, L))) aset.add(an) L = lcm(L, an) while m in aset: m += 1 print(list(islice(agen(), 65))) # Michael S. Branicky, Aug 30 2024
Comments