MathGroup Archive 2012

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: How to count


Artur:

	Your code requires computing n! twice for each n.  You might try
something like this instead:

	ss[n_]:=Module[{nf=n!},(Floor[Sqrt[nf]]+1)^2-nf]

But for large n, Mathematica cannot compute n! because of overflow.

	Best,

	Harvey


-----Original Message-----
From: Artur [mailto:grafix at csl.pl]
Sent: Thursday, March 29, 2012 3:55 AM
To: mathgroup at smc.vnet.net
Subject: [mg125719] How to count

Dear Mathematica Gurus!

I have seriously problem with counting distances between smallest square
bigger than n! (for big n) e.g.

aa = {}; Do[k = 1 + Floor[Sqrt[n!]]; kk = k^2 - n!; Print[kk];
  kkk = N[Log[kk], 100]; Print[kkk];
  AppendTo[aa, kkk], {n, 1, 10000000, 1000000}]; aa

Who have idea how to count this on Mathematica?

Best wishes
Artur




  • Prev by Date: Re: Manipulate[Plot[Evaluate[expr]]]
  • Next by Date: ChartElements in BarChart doesn't plot negatives any ideas?
  • Previous by thread: How to count
  • Next by thread: Re: How to count