MathGroup Archive 2007

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

Search the Archive

request for a few minutes CPU-time

  • To: mathgroup at smc.vnet.net
  • Subject: [mg79477] request for a few minutes CPU-time
  • From: Peter Pein <petsie at dordos.net>
  • Date: Fri, 27 Jul 2007 06:01:06 -0400 (EDT)

Dear group,

I've written code, which looks for numbers for which a smaller natural
number exists which has the same sum of cubes of it's divisors:

Block[{spa, nmax = 6*106, expo = 3},
   Reap[For[n = 1, n <= nmax, n++,
      (If[Head[#1] === spa, #1 = n, Sow[{n, #1}]] & )[
       spa[DivisorSigma[expo, n]]]]][[2,1]]]

the name spa is an artefact; I tried this with SparseArrays, but the
allowed range of indices has not been sufficient. I now use spa as an
initially undefined function (Block[{spa..}]). For each n to test I look
wether spa[sigma(r,n)] has been defined. If not, the Head is still spa
and I set spa[sigma(r,n)] to n; else the remembered value together with
n will go to the result via the Sow-Reap mechanism.

 If you've got RAM (4GB or so) than I do (1.5 GB),
could you please run this code  with, say nmax=10 or 20 million? On my
machine it swapped heavily with nmax=6 million and I had to kill
MathKernel as I tried nmax=10^7. The lines above took ~181 seconds to
evaluate (nmax=10^7 has been stopped by me after 15 minutes). I do not
expect any runtimes of more than ~7-10 minutes. Would this be possible,
please?

 Alternatively any hints how to calculate these sequences more efficient
would be highly appreciated (AFAIK there exists no kind of "inverse
function" to sigma(r,n) w.r.t. n which could be calculated without this
brute-force method).

Thank you for your attention and in advance for CPU-time,

Peter


  • Prev by Date: Re: Volterra Equation?
  • Next by Date: Re: approximation
  • Previous by thread: [Mathematica 6] spurious $Aborted messages. How to track down cause?
  • Next by thread: Re: request for a few minutes CPU-time