Re: need a quicker method for SquaresR func

*To*: mathgroup at smc.vnet.net*Subject*: [mg121231] Re: need a quicker method for SquaresR func*From*: Dana DeLouis <dana01 at me.com>*Date*: Mon, 5 Sep 2011 07:06:52 -0400 (EDT)*Delivered-to*: l-mathgroup@mail-archive0.wolfram.com

> SquaresR ... like JacobiTheta OR something else.... Hi. I see you don't have an answer. I don't either, but I thought this was interesting http://mathworld.wolfram.com/SumofSquaresFunction.html Item # 39 had a code for R4. Downloading the workbook gave this as 1 alternative as a generating function, but I'm afraid it's slower. fx[n_]:=Coefficient[Series[EllipticTheta[3,0,q]^4,{q,0,n}],q,n] fx[10000]//Timing {4.65, 18744} SquaresR[4,10000]//Timing {0.00008, 18744} This version was faster, but not as fast as the built-in function: 8 Plus@@Select[Divisors[100000000],Mod[#,4]!=0&]//Timing {0.002715,11718744} SquaresR[4,100000000]//Timing {0.000972,11718744} As a side note, it looks like the solution is about 2-3 times the size of the input, on average. So, I would guess your answer is larger than your input. Sounds like a tough problem with inputs that large. t=Table[SquaresR[4,n]/n //N, {n,1000,300000,1000}] ; {Mean[t],StandardDeviation[t]} {2.956801,1.680969} = = = = = = = = = = Good Luck. :>) Dana DeLouis $Version 8.0 for Mac OS X x86 (64-bit) (November 6, 2010) On Aug 25, 7:12 am, Time Traveler <time.traveler... at gmail.com> wrote: > Hi; > For a research project I need a quicker way to obtain SquaresR > function. example --> SquaresR[4 , H] . The problem is ; > > Integer H is quite large (about 200 digit) and it takes exceedingly > long time to return the ans. Is there a quicker way to find this > stated function by a different methods, like JacobiTheta OR > something else.... > > Thanks for help in advance > Time