OFFSET
1,2
LINKS
FORMULA
EXAMPLE
a(30) = 30 because 30=2*3*5, a(15) = 1 because 15=3*5.
MAPLE
N:= 1000: # to get a(1)..a(N)
P:= 1: p:= 1:
A:= Vector(N, 1):
do
p:= nextprime(p);
P:= P*p;
if P > N then break fi;
A[[seq(i, i=P..N, P)]]:= P;
od:
convert(A, list); # Robert Israel, Aug 30 2016
MATHEMATICA
Table[k = 1; While[Divisible[n, Times @@ Prime@ Range@ k], k++]; Times @@ Prime@ Range[k - 1], {n, 120}] (* Michael De Vlieger, Aug 30 2016 *)
PROG
(PARI) a(n)=my(f=factor(n), r = 1, k = 1, p); while(k<=matsize(f)[1], p=prime(k); if(f[k, 1]!=p, return(r)); r*=p; k++) ; r
a(n) = my(r = 1, p = 2); while(n/p==n\p, r*=p; p=nextprime(p+1)); r
\\ list of all terms up to n#.
lista(n) = my(l = List([1]), k, s=1); forprime(i=2, n, for(j=1, i-1, for(k=1, s, listput(l, l[k]))); l[#l]*=i; s=#l); l \\ David A. Corneth, Aug 30 2016
(PARI) a(n)=my(s=1); forprime(p=2, , if(n%p, return(s), s *= p)) \\ Charles R Greathouse IV, Sep 07 2016
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Frederick Magata (frederick.magata(AT)uni-muenster.de), Jan 19 2000
EXTENSIONS
More terms from Larry Reeves (larryr(AT)acm.org), Oct 02 2000
STATUS
approved