[seqfan] Re: Questions concerning A003418 and A002944.

Maximilian Hasler maximilian.hasler at gmail.com
Tue Jun 23 20:42:49 CEST 2009

On Tue, Jun 23, 2009 at 1:30 PM, <peter.luschny at googlemail.com> wrote:

> A003418(n) = lcm({1,2,3,...,n})
> A002944(n) = lcm({1,2,3,...,n})/n
> (1) A003418: seq (denom(sum((-1)^i/i, i = 1..n)), n=0..30);"
> (Zerinvary Lajos) looks erroneous. First discrepancy at n=16.


 Perhaps the author meant A058312(n).
>  And PARI?

the first PARI code also is bad, it gives a wrong result e.g. for n=27 on
the computer I'm right now,
where the result is off by one power of 3
(but this may depend on the kernel used and on the machine dependent default
If it is changed to:
A003418(n)={local(t=1); forprime(p=2, n, t*=p^(log(n+.5)\log(p))); t}
then the result is ok for (very) much larger n.
(I think the idea of the code is clear: the lcm of all numbers <= n is the
same than that of all prime powers <= n and thus that of the largest prime
powers <= n.)

Also, I don't understand the purpose for the second version,
1/content(...1/k) ;
in any case the simplest would be


which works in particular for n=0, and is much faster than the above "prime
power" version.


More information about the SeqFan mailing list