All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Numbers
Sum of Three Squares (Posted on 2024-07-27) Difficulty: 3 of 5
Determine the smallest positive integer that can be expressed as the sum of three nonzero squares in five different ways.

No Solution Yet Submitted by K Sengupta    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution computer solution (spoiler) | Comment 1 of 2
v=zeros(1,200^2);

% find sums, keeping count
for tot=1:100
  for a=1:tot/3
    a2=a^2;
    for b=a:(tot-a)/2
      c=tot-a-b;
      n=a2+b^2+c^2;
      v(n)=v(n)+1;
    end
  end
end

% find count >= 5
for i=1:length(v)
  if v(i)>=5
    disp([i v(i)])
    break
  end
end

% report stats on the one found
for tot=1:100
  for a=1:tot/3
    a2=a^2;
    for b=a:(tot-a)/2
      c=tot-a-b;
      n=a2+b^2+c^2;
      if n==i
        disp([a b c a^2 b^2 c^2])
      end
    end
  end
end

finds that 194 is the first such sum:



   194     5
   
     a     b     c   a^2   b^2   c^2
     
     1     7    12     1    49   144
     3     4    13     9    16   169
     3     8    11     9    64   121
     5     5    12    25    25   144
     7     8     9    49    64    81

  Posted by Charlie on 2024-07-27 08:12:31
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (2)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information