Jump to content

Sequence: smallest number with exactly n divisors: Difference between revisions

m
Line 412:
elsif f[2]>2 -- (see note)
and f[$] = power(f[2],lf-1) then ri = power(product(get_primes(-(lf-1))),f[2]-1) -- p^k (eg f={1,3,9,27})
elsif length(f)lf=4 then ri = power(2,f[3]-1)*power(3,f[2]-1) -- p*q (eg f={1,2,3,6})
else populate_found(i) ri = found[i] -- do the rest manually
end if
printf(1,"%d->%d\n",{i,ri})
end for</lang>
Note: the f[2]>2 test should really be something more like >log(primes[get_primes(-(lf-1))[$])/log(2),
apparently, but everything seems ok within the IEEE 754 53/64 bit limits this imposes.
It takes longer, afaict, to print the answers that it did to calculate them, tee hee!
{{out}}
7,820

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.