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

Home > Numbers
Sum of 4 squares (Posted on 2018-07-08) Difficulty: 3 of 5
The number N is a sum of 4 different numbers, each being a square of one of the 4 smallest divisors of N (e.g. N=36 does not qualify since 1^2+2^2+3^2+4^2
sums up to 30, not 36.)

Provide a full list of similar numbers or show that none exist.

See The Solution Submitted by Ady TZIDON    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Just S/W notes... Comment 4 of 4 |

Two software notes:

Here is the Gnu Fortran version of the same routine for comparison.

Also, I worry about Charlie's cutoff of "sr=sqr(N)"

This would have missed, e.g., 3 as a factor of 6 (I think).

(I note this because I did the same thing at first.)

(Later... thinking it over, this makes sense since we can't use factors greater than sqrt(N) for the sum. Never mind!)

         program dd

        implicit none

        integer list(4),i,j,k,jj,cnt

           do 1 i=1,100000

           cnt=0

                do k=1,i

                    if(k*int((1.*i)/k).eq.i)then

                    cnt=cnt+1

                    list(cnt)=k

                        if(cnt.eq.4)then

        jj=list(1)**2+list(2)**2+list(3)**2+list(4)**2

                            if(jj.eq.i)then

                            print*,' solved: ',i,list

                            go to 1

                            else

                            go to 1

                            endif

                        endif

                    endif

                enddo

1           enddo

        end


rabbit-3:~ lord$ dd

  solved:   130  1  2  5  10

Edited on July 9, 2018, 2:49 am

Edited on July 9, 2018, 6:21 pm
  Posted by Steven Lord on 2018-07-08 22:59:26

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 (15)
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