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

Home > Numbers
Pythagorean areas (Posted on 2017-11-17) Difficulty: 3 of 5
List all Pythagorean triangles whose area utilizes
9 different digits.

See The Solution Submitted by Ady TZIDON    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Some Thoughts Either .... | Comment 1 of 7
... there's a bug in my program, below, or the area has some repeated digit(s) and therefore has more than 9 digits overall.

   10        dim Fct(20,1)
   20        S$="1023456789":H$=S$
   30        while left(S$,1)>"0"
   40          Nm=2*val(left(S$,9))
   50          F=fnFactor(Nm)
   60          Leg1=1:DidOdd=0
   70          gosub *AddOn(1)
   80  
   90          gosub *Permute(&S$)
  100        wend
  999        end
 1000  
 1010        *AddOn(Wh)
 1020         local Hisub,I
 1030         if Fct(Wh,1)@2=1 and DidOdd=0 then
 1040            :Hisub=(Fct(Wh,1)+1)\2-1
 1050            :DidOdd=1
 1060         :else
 1070            :Hisub=Fct(Wh,1)
 1080         for I=0 to Hisub
 1090           Leg1=Leg1*Fct(Wh,0)^I
 1100           if Wh<F then
 1110             :gosub *AddOn(Wh+1)
 1120           :else
 1130             :Leg2=Nm\Leg1
 1140             :Sq=Leg1^2+Leg2^2
 1150             :Sr=int(sqrt(Sq)+0.5)
 1160             :if Sr*Sr=Sq then
 1170                :print Leg1,Leg2,Sr
 1180           Leg1=Leg1\Fct(Wh,0)^I
 1190         next I
 1200        return

  Posted by Charlie on 2017-11-17 14:26:43
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 (7)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

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