A053589 Greatest primorial number (A002110) which divides n.
1, 2, 1, 2, 1, 6, 1, 2, 1, 2, 1, 6, 1, 2, 1, 2, 1, 6, 1, 2, 1, 2, 1, 6, 1, 2, 1, 2, 1, 30, 1, 2, 1, 2, 1, 6, 1, 2, 1, 2, 1, 6, 1, 2, 1, 2, 1, 6, 1, 2, 1, 2, 1, 6, 1, 2, 1, 2, 1, 30, 1, 2, 1, 2, 1, 6, 1, 2, 1, 2, 1, 6, 1, 2, 1, 2, 1, 6, 1, 2, 1, 2, 1, 6, 1, 2, 1, 2, 1, 30, 1, 2, 1, 2, 1, 6, 1, 2, 1, 2, 1, 6
Offset: 1
Examples
a(30) = 30 because 30=2*3*5, a(15) = 1 because 15=3*5.
Links
Crossrefs
Programs
-
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 *)
-
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
-
Scheme
(define (A053589 n) (A002110 (A276084 n))) ;; Antti Karttunen, Aug 30 2016
Formula
Extensions
More terms from Larry Reeves (larryr(AT)acm.org), Oct 02 2000