Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#6509 closed enhancement (duplicate)

sum of four squares function

Reported by: mhampton Owned by: somebody
Priority: minor Milestone: sage-duplicate/invalid/wontfix
Component: basic arithmetic Keywords:
Cc: Merged in:
Authors: Reviewers: jsp
Report Upstream: Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description

This can probably be improved, but its a first attempt that seems to work.

Attachments (1)

trac_6509_four_squares.patch (3.2 KB) - added by mhampton 12 years ago.

Download all attachments as: .zip

Change History (6)

comment:1 Changed 12 years ago by mhampton

  • Summary changed from sum of four squares function to [with patch, needs review] sum of four squares function

Changed 12 years ago by mhampton

comment:2 Changed 12 years ago by mhampton

Oops, last one had a few mistakes. Current version is correct up to 10000 I think with the new "long" doctest.

comment:3 Changed 12 years ago by jsp

  • Reviewers changed from wstein to jsp
  • Summary changed from [with patch, needs review] sum of four squares function to [with patch, positive review] sum of four squares function

Tested this with a lot of values taken from: http://www.research.att.com/~njas/sequences/A006431

and usage of:

http://www.alpertron.com.ar/FSQUARES.HTM

When we look at http://www.research.att.com/~njas/sequences/A002635 we see that for instance 82 can be written in 7 ways as the sum of 4 squares. For more results see: http://www.research.att.com/~njas/sequences/b002635.txt

So indeed this can be improved. But for now this is ok for a first attempt. Positive review.

Jaap

comment:4 Changed 12 years ago by mvngu

  • Milestone changed from sage-4.1.1 to sage-duplicate/invalid/wontfix
  • Resolution set to duplicate
  • Status changed from new to closed

This is a duplicate of ticket #6529. That ticket also incorporates the code contained in trac_6509_four_squares.patch.

comment:5 Changed 12 years ago by mvngu

  • Summary changed from [with patch, positive review] sum of four squares function to sum of four squares function
Note: See TracTickets for help on using tickets.