Skip to content

lemonleo1337/square_sum_prod

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This fork mission statement:

Use only "gaussian" tool, under symbolic link "square_sum_prod".
Assert on even or "≡3 (mod 4)" factors.
Instead of "a + b*i" output "(a**2 + b**2)".
Output " * " between factors, and final " == " followed by input.

Because of Fermat's theorem on sums of two squares each factor "≡1 (mod 4)" has unique representation as sum of two squares.

@alpertron's cool gaussian calculator allows to process 120-digit number in less than a second !

Just "make" shows demo after build:

pi@pi400-64:~/square_sum_prod $ make
./square_sum_prod 97
(9**2 + 4**2) == 97

./square_sum_prod 169 py
3,2,3,2
./square_sum_prod 693342667110830181197325401899700641361965863127336680673013|\
python -c 'import sys;l=sys.stdin.read().rstrip();print(l,"\n"+str(eval(l)))'
(832050675380196295918334279642**2 + 32161167736719180733109944457**2) == 693342667110830181197325401899700641361965863127336680673013 
True

./square_sum_prod 1105|\
python -c 'import sys;l=sys.stdin.read().rstrip();print(l,"\n"+str(eval(l)))'
(2**2 + 1**2) * (3**2 + 2**2) * (4**2 + 1**2) == 1105 
True

pi@pi400-64:~/square_sum_prod $ 

Second example demonstrates quick and dirty Python support, see comments in Popen.py for details (I know that dirty remains long after quick is gone).

Computing unique sum of squares for primes ≡1 (mod 4) took:

Original README.md:

Results of static analysis and code coverage of this software using Codacy.

Badges from SonarCloud:

Bugs Code Smells Coverage Duplicated Lines (%) Lines of Code Maintainability Rating Quality Gate Status Reliability Rating Security Rating Technical Debt Vulnerabilities

If you like these calculators and you want to support free software, you can donate by clicking in one of the buttons below:

Paypal: paypal

Liberapay:

About

Use gaussian calculator for sum of squares product for ≡1 (mod 4) numbers

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • HTML 57.8%
  • C 24.4%
  • Java 13.8%
  • JavaScript 3.4%
  • Shell 0.2%
  • Batchfile 0.2%
  • Other 0.2%