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)
LINKS
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
KEYWORD
nonn,easy
AUTHOR
Yifan Xie, Aug 25 2024
STATUS
approved