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

 Pythagorean areas (Posted on 2017-11-17)
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.)
 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
80
90          gosub *Permute(&S\$)
100        wend
999        end
1000
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
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

 Search: Search body:
Forums (0)