#R, 52 bytes
R, 52 bytes
`if`((n=scan())<2,1,prod(unique(c(1,gmp::factorize(n))))
reads n
from stdin. Requires the gmp
library to be installed (so TIO won't work). Uses the same approach as many of the above answers, but it crashes on an input of 1
, because factorize(1)
returns an empty vector of class bigz
, which crashes unique
, alas.