HP 50g Programming Competition: How Many Partitions of an Integer in 4 Squares
04-14-2018, 08:18 PM (This post was last modified: 04-14-2018 08:36 PM by Thomas Ritschel.)
Post: #5
 Thomas Ritschel Member Posts: 66 Joined: Feb 2014
RE: HP 50g Programming Competition: How Many Partitions of an Integer in 4 Squares
(04-14-2018 06:17 PM)Gerald H Wrote:  I have copied your programmes, Thomas, & for input

720^20

the programme returned

52175039830928864354013492999359544

in

1.42 sec.

In my test I had 720^20 as an algebraic object on stack level 1, e.g. entered as '720^20'.

However, when 720^20 is evaluated to 1401683395356260729391818575873415577600000000000000000000 first, and then the Jacobi program is called, I also get 52175039830928864354013492999359544 in about 1.4 sec.

It turns out, that it fails for some kind of algebraic terms like 'a^b' or 'a*b', but not all of them (e.g. '3*11' seems to work well).

To make it save, an 'EVAL' should be added to the Jacobi program:

Code:
%%HP: T(3)A(R)F(.);
\<< EVAL DUP 4 MOD
IF 0 ==
THEN DUP 4 / \Gs 32 * NEG
ELSE 0
END SWAP \Gs 8 * +
\>>
 « Next Oldest | Next Newest »

 Messages In This Thread HP 50g Programming Competition: How Many Partitions of an Integer in 4 Squares - Gerald H - 04-13-2018, 11:35 AM RE: HP 50g Programming Competition: How Many Partitions of an Integer in 4 Squares - pier4r - 04-13-2018, 01:12 PM RE: HP 50g Programming Competition: How Many Partitions of an Integer in 4 Squares - Thomas Ritschel - 04-14-2018, 05:10 PM RE: HP 50g Programming Competition: How Many Partitions of an Integer in 4 Squares - Gerald H - 04-14-2018, 06:17 PM RE: HP 50g Programming Competition: How Many Partitions of an Integer in 4 Squares - Thomas Ritschel - 04-14-2018 08:18 PM RE: HP 50g Programming Competition: How Many Partitions of an Integer in 4 Squares - Valentin Albillo - 04-15-2018, 12:08 AM RE: HP 50g Programming Competition: How Many Partitions of an Integer in 4 Squares - Gerald H - 04-15-2018, 04:58 AM RE: HP 50g Programming Competition: How Many Partitions of an Integer in 4 Squares - pier4r - 04-15-2018, 08:36 AM RE: HP 50g Programming Competition: How Many Partitions of an Integer in 4 Squares - Valentin Albillo - 04-16-2018, 11:31 PM RE: HP 50g Programming Competition: How Many Partitions of an Integer in 4 Squares - c0manche - 04-17-2018, 12:10 AM RE: HP 50g Programming Competition: How Many Partitions of an Integer in 4 Squares - Thomas Ritschel - 04-15-2018, 11:42 AM RE: HP 50g Programming Competition: How Many Partitions of an Integer in 4 Squares - Thomas Ritschel - 04-15-2018, 02:07 PM RE: HP 50g Programming Competition: How Many Partitions of an Integer in 4 Squares - Gerald H - 04-15-2018, 03:09 PM RE: HP 50g Programming Competition: How Many Partitions of an Integer in 4 Squares - Thomas Ritschel - 04-15-2018, 03:34 PM RE: HP 50g Programming Competition: How Many Partitions of an Integer in 4 Squares - Gerald H - 04-15-2018, 04:38 PM RE: HP 50g Programming Competition: How Many Partitions of an Integer in 4 Squares - Thomas Ritschel - 04-15-2018, 06:54 PM RE: HP 50g Programming Competition: How Many Partitions of an Integer in 4 Squares - Gerald H - 04-15-2018, 07:06 PM RE: HP 50g Programming Competition: How Many Partitions of an Integer in 4 Squares - Gerald H - 04-15-2018, 07:11 PM RE: HP 50g Programming Competition: How Many Partitions of an Integer in 4 Squares - Thomas Ritschel - 04-16-2018, 01:19 PM RE: HP 50g Programming Competition: How Many Partitions of an Integer in 4 Squares - Gerald H - 04-17-2018, 05:03 AM RE: HP 50g Programming Competition: How Many Partitions of an Integer in 4 Squares - Valentin Albillo - 04-17-2018, 02:00 PM RE: HP 50g Programming Competition: How Many Partitions of an Integer in 4 Squares - John Keith - 04-17-2018, 05:42 PM RE: HP 50g Programming Competition: How Many Partitions of an Integer in 4 Squares - Gerald H - 04-18-2018, 04:53 AM RE: HP 50g Programming Competition: How Many Partitions of an Integer in 4 Squares - Gerald H - 04-18-2018, 05:31 AM RE: HP 50g Programming Competition: How Many Partitions of an Integer in 4 Squares - Valentin Albillo - 04-19-2018, 04:52 PM RE: HP 50g Programming Competition: How Many Partitions of an Integer in 4 Squares - Thomas Ritschel - 04-20-2018, 06:52 AM RE: HP 50g Programming Competition: How Many Partitions of an Integer in 4 Squares - Gerald H - 04-18-2018, 11:05 AM RE: HP 50g Programming Competition: How Many Partitions of an Integer in 4 Squares - Thomas Ritschel - 04-20-2018, 07:35 AM RE: HP 50g Programming Competition: How Many Partitions of an Integer in 4 Squares - Valentin Albillo - 04-20-2018, 12:24 PM RE: HP 50g Programming Competition: How Many Partitions of an Integer in 4 Squares - Gerald H - 04-20-2018, 02:04 PM

User(s) browsing this thread: 1 Guest(s)