login
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
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,2
COMMENTS
This is a permutation of the positive integers.
From Yifan Xie, Jan 09 2025: (Start)
The sequence can be constructed using the following properties:
1. The squares appear in increasing order.
2. p^(2k) is immediately followed by p^(2k-1), 2*p^(2k-1), ..., (p-1)*p^(2k-1) for prime p.
3. The numbers m^2 < k < (m+1)^2 such that A006530(k) < A051119(k) appear in increasing order between m^2 and (m+1)^2.
a(n) > a(n-1) iff a(n) = p^(2k) and a(n-1) = p^(2k-1), where p is a prime. (End)
EXAMPLE
For n = 4, a(4) is different from 1, 2, 4, and lcm(4, a(4)) is a perfect square. Therefore, a(4) = 9.
PROG
(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
CROSSREFS
Cf. A006530 (Gpf(n)), A051119 (largest divisor of n coprime to Gpf(n)).
Sequence in context: A201281 A095303 A060734 * A075594 A076022 A064421
KEYWORD
nonn,easy
AUTHOR
Yifan Xie, Aug 25 2024
STATUS
approved