login
Greatest primorial number (A002110) which divides n.
23

%I #31 Jun 04 2023 23:50:31

%S 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,

%T 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,

%U 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

%N Greatest primorial number (A002110) which divides n.

%H Antti Karttunen, <a href="/A053589/b053589.txt">Table of n, a(n) for n = 1..2309</a>

%H <a href="/index/Pri#primorial_numbers">Index entries for sequences related to primorial numbers</a>

%F From _Antti Karttunen_, Aug 30 2016: (Start)

%F a(n) = A002110(A276084(n)).

%F a(n) = n/A111701(n).

%F A276157(n) = A260188(n)/a(n).

%F (End)

%e a(30) = 30 because 30=2*3*5, a(15) = 1 because 15=3*5.

%p N:= 1000: # to get a(1)..a(N)

%p P:= 1: p:= 1:

%p A:= Vector(N,1):

%p do

%p p:= nextprime(p);

%p P:= P*p;

%p if P > N then break fi;

%p A[[seq(i,i=P..N,P)]]:= P;

%p od:

%p convert(A,list); # _Robert Israel_, Aug 30 2016

%t Table[k = 1; While[Divisible[n, Times @@ Prime@ Range@ k], k++]; Times @@ Prime@ Range[k - 1], {n, 120}] (* _Michael De Vlieger_, Aug 30 2016 *)

%o (Scheme) (define (A053589 n) (A002110 (A276084 n))) ;; _Antti Karttunen_, Aug 30 2016

%o (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

%o a(n) = my(r = 1, p = 2); while(n/p==n\p, r*=p; p=nextprime(p+1));r

%o \\ list of all terms up to n#.

%o 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

%o (PARI) a(n)=my(s=1); forprime(p=2,, if(n%p, return(s), s *= p)) \\ _Charles R Greathouse IV_, Sep 07 2016

%Y Cf. A002110, A276084, A053669, A111701, A276151, A276152, A276157, A260188, A276086, A276150.

%K nonn,easy

%O 1,2

%A Frederick Magata (frederick.magata(AT)uni-muenster.de), Jan 19 2000

%E More terms from Larry Reeves (larryr(AT)acm.org), Oct 02 2000