MathGroup Archive 2011

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

Search the Archive

Re: need a quicker method for SquaresR func

  • To: mathgroup at
  • Subject: [mg121231] Re: need a quicker method for SquaresR func
  • From: Dana DeLouis <dana01 at>
  • Date: Mon, 5 Sep 2011 07:06:52 -0400 (EDT)
  • Delivered-to:

> 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

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.


{4.65, 18744}

{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


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}]  ;


= = = = = = = = = =
Good Luck.  :>)
Dana DeLouis
8.0 for Mac OS X x86 (64-bit) (November 6, 2010)

On Aug 25, 7:12 am, Time Traveler <time.traveler... at> 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

  • Prev by Date: Re: Print bug with -script? (quotes display)
  • Next by Date: Re: Assembling PDFs into a PDF document?
  • Previous by thread: Re: Confusing Result with Series
  • Next by thread: Preprocessing file input