MathGroup Archive 2012

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

Search the Archive

Re: How to count

  • To: mathgroup at smc.vnet.net
  • Subject: [mg125729] Re: How to count
  • From: Costa Bravo <q13a27tt at aol.com>
  • Date: Fri, 30 Mar 2012 04:35:18 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <jl14ig$l5e$1@smc.vnet.net>

Artur wrote:

> 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?
>

funa[n_]:=Module[{lg,lg1,ns},
lg=N[LogGamma[n+1]];
lg1=N[LogGamma[n+1],102+Round[lg/2/Log[10]]];
ns=Exp[lg1];
N[Log[(1+Floor[Sqrt[ns]])^2-ns],100]]

aa={};w = 5 (* 6 *);
Do[Print[k,"   ",Timing[kkk=funa[k]]];
AppendTo[aa,kkk],{k, 1 ,10^(w+1),10^w}];

OK ?!

-- 
   Costa



  • Prev by Date: Re: prim algorithm
  • Next by Date: Re: Equality...
  • Previous by thread: Re: How to count
  • Next by thread: Re: How to count