OFFSET
0,2
COMMENTS
FORMULA
a(0) = 1, a(1) = 2; for n > 1, let p be the smallest prime such that n-1 is divisible by p but not by p^2, then a(n) = p^n, or 0 if no such p exists.
EXAMPLE
By the formula shown in A328914, if f(N) = 7, then N must be divisible by either 2^7 = 128 or 3^7 = 729, so the smallest N is a(7) = 128.
PROG
(PARI) a(n) = if(n==0, 1, if(n==1, 2, my(v=factor(n-1)); for(i=1, omega(n-1), if(v[i, 2]==1, return(v[i, 1]^n))); return(0)))
CROSSREFS
KEYWORD
nonn
AUTHOR
Jianing Song, Oct 31 2019
STATUS
approved