hermann on Wed, 27 Nov 2024 23:30:41 +0100


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Fwd: 25! with early aborts: 31ms to find minimal 5x5 square of distinct primes with sum of rows/cols/diags prime and total sum prime(!)


Sorry,

I got informed that the mersenneforum.org links do not work currently (for me they do). Mersenne forum switches between requiring login with account and no login needed.

I added all information to this gist in comments:
https://gist.github.com/Hermann-SW/bef5b46a62a443a0d143f55118f0c9b8

The dynamcic program I mentioned is here:
https://gist.github.com/Hermann-SW/bef5b46a62a443a0d143f55118f0c9b8?permalink_comment_id=5305268#gistcomment-5305268

Regards,

Hermann.
-------- Original Message --------
Subject: 25! with early aborts: 31ms to find minimal 5x5 square of distinct primes with sum of rows/cols/diags prime and total sum prime(!)
Date: 2024-11-27 22:54
From: hermann@stamm-wilbrandt.de
To: pari-users@pari.math.u-bordeaux.fr

I always get surprised how easy things can be done with PARI/GP.

My first dynamic program in PARI/GP with sets (subset sum with knowing all possible subset sizes):
https://www.mersenneforum.org/node/1055343?p=1062012#post1062012

And how fast GP is.

The gist is my forst ever code with 25 nester for loops on variables a..y, more info:
https://www.mersenneforum.org/node/1055343?p=1062097#post1062097

pi@raspberrypi5:~/PrimeSquares $ time gp -q < sum25f.gp
{[3,5,7,11,17;
67,41,43,13,47;
37,53,19,59,113;
31,23,71,61,97;
29,89,83,79,73];}

real	0m0.031s
user	0m0.028s
sys	0m0.004s
pi@raspberrypi5:~/PrimeSquares $

pi@raspberrypi5:~/PrimeSquares $ cat > 1171.gp
{[3,5,7,11,17;
67,41,43,13,47;
37,53,19,59,113;
31,23,71,61,97;
29,89,83,79,73];}
pi@raspberrypi5:~/PrimeSquares $ ps=1171.gp gp -q < validate.gp
1171.gp, sum: 1171, validated
pi@raspberrypi5:~/PrimeSquares $


Regards,

Hermann.