(49g 50g) Ramanujan Tau Function - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Software Libraries (/forum-10.html) +--- Forum: General Software Library (/forum-13.html) +--- Thread: (49g 50g) Ramanujan Tau Function (/thread-11587.html) |
(49g 50g) Ramanujan Tau Function - John Keith - 10-12-2018 02:07 PM These programs compute the Ramanujan tau function (A000594) for positive integers. All three programs use Gerald Hilliers SUMDIVISORS command from hpcalc.org, and must be run in exact mode. The last two programs also require the ListExt Library. Neither program is very fast, and use of an emulator is recommended for large integers. Edited 10/13/2018 to replace the first two programs with slightly smaller and faster versions. The first program is the most general, and can calculate tau(n) for any size integer, given enough time. This is essentially the same algorithm as program #2 here. Code:
The next program is about 25% faster than the previous one. It is limited to integers less than 2000 or so because of the memory required by the precomputed sigma values. Code:
The last program returns a list of tau values from 1 through n. It is significantly faster than computing the individual values with the programs above, but still quite slow for large integers. Code:
EDIT: The program above can be used to compute many other sequences if the -24 in line 3 is replaced by another number. Details and a more general program here. RE: (49g 50g) Ramanujan Tau Function - Gerald H - 10-20-2018 08:14 PM If you only want the sum of 1st power of divisors this programme is more economical: Size: 117. CkSum: # 87h Code: :: RE: (49g 50g) Ramanujan Tau Function - John Keith - 11-02-2018 01:26 AM Thanks, Gerald, I just now noticed your reply. I'm not very knowledgeable about SysRPL but I will study your program carefully. I would like to port the Ramanujan tau program to the Prime but it has only the Divisors function (like the 50g), not a fast way of calculating sums of divisor powers. RE: (49g 50g) Ramanujan Tau Function - Gerald H - 11-02-2018 04:02 PM Here's my shortest & fastest effort at a stand alone programme, only good for input up to 1,048,575 but that's no great handicap as the programme is slow, taking 9 sec to process input 100 & 18 sec for input 200, the time characteristic being linear on the input. Size: 350.0000 CkSum: # 59690d Code: :: RE: (49g 50g) Ramanujan Tau Function - John Keith - 11-06-2018 10:18 PM Thanks, really neat! |