OFFSET
1,2
COMMENTS
Define f(x) to be lpf(k)*k, where lpf(k) = A020639(k). This sequence contains the mappings of f(x) across squarefree numbers A005117.
a(1) = 1 by definition. 1 is the empty product and has no least prime factor.
Define sequence R_k = { m : rad(m) | k }, where rad(n) = A007947(n) and k > 1 is squarefree. Then the sequence k*R_k contains all numbers divisible by squarefree k that are also not divisible by any prime q coprime to k.
Plainly, k is the first term in the sequence k*R_k, because 1 is the first term in R_k. Hence a(n) is the second term in k*R_k for n > 1, since lpf(k) is the second term in R_k.
LINKS
Michael De Vlieger, Table of n, a(n) for n = 1..10000
FORMULA
EXAMPLE
MATHEMATICA
nn = 120; s = Select[Range[nn], SquareFreeQ];
Array[#*FactorInteger[#][[1, 1]] &[s[[#]]] &, Length[s]]
PROG
(PARI) apply(x->(if (x==1, 1, x*vecmin(factor(x)[, 1]))), select(issquarefree, [1..150])) \\ Michel Marcus, Dec 17 2023
(Python)
from math import isqrt
from sympy import mobius, primefactors
def A366786(n):
def f(x): return n+x-sum(mobius(k)*(x//k**2) for k in range(1, isqrt(x)+1))
def bisection(f, kmin=0, kmax=1):
while f(kmax) > kmax: kmax <<= 1
while kmax-kmin > 1:
kmid = kmax+kmin>>1
if f(kmid) <= kmid:
kmax = kmid
else:
kmin = kmid
return kmax
return (m:=bisection(f))*min(primefactors(m), default=1) # Chai Wah Wu, Aug 31 2024
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Michael De Vlieger, Dec 16 2023
STATUS
approved