How many Pythagorean triangles are there whose area is expressed by 9 different digits?
Provide the values for the smallest and the biggest of them.
(In reply to
No Subject by Charlie)
22836 82175 85289 938274150 132 475 493
18623 101580 103273 945862170 11 60 61
21952 86436 89180 948721536 16 63 65
3936 484120 484136 952748160 492 60515 60517
3128 611520 611528 956417280 391 76440 76441
20930 91392 93758 956417280 1495 6528 6697
24240 78982 82618 957261840 120 391 409
33500 58011 66989 971684250 33500 58011 66989
4992 389360 389392 971842560 312 24335 24337
16140 120512 121588 972531840 15 112 113
25824 75320 79624 972531840 12 35 37
43040 45192 62408 972531840 20 21 29
17874 108832 110290 972631584 8937 54416 55145
28510 68424 74126 975384120 5 12 13
38256 51008 63760 975681024 3 4 5
21217 92544 94945 981753024 21217 92544 94945
43300 45465 62785 984317250 20 21 29
25980 75775 80105 984317250 12 35 37
DECLARE FUNCTION gcd# (a#, b#)
DEFDBL A-Z
CLS
OPEN "bigareas.txt" FOR OUTPUT AS #2
doing = 1
WHILE doing
n = n + 1
m = n + 1
IF m * m * m * n - m * n * n * n > 1000000000# THEN doing = 0
WHILE m * m * m * n - m * n * n * n < 1000000000#
IF gcd(m, n) = 1 THEN
a = m * m - n * n: b = 2 * m * n: c = m * m + n * n
IF b < a THEN SWAP b, a
area0 = a * b / 2
k0 = INT(SQR(100000000# / area0))
FOR k = k0 TO -INT(-SQR(10) * k0) + 2
area1 = k * k * area0
s$ = LTRIM$(STR$(area1))
IF LEN(s$) = 9 THEN
good = 1
FOR i = 1 TO 8
IF INSTR(MID$(s$, i + 1), MID$(s$, i, 1)) THEN good = 0: EXIT FOR
NEXT
IF good THEN
PRINT USING "####### ####### ####### #########"; k * a; k * b; k * c; area1
PRINT #2, USING "####### ####### ####### #########"; k * a; k * b; k * c; area1;
PRINT #2, USING "########"; a; b; c
ct = ct + 1
END IF
END IF
NEXT
END IF
m = m + 2
WEND
WEND
PRINT ct
CLOSE 2
FUNCTION gcd (a, b)
x = a: y = b
DO
q = INT(x / y): r = x - y * q
IF r = 0 THEN gcd = y: EXIT FUNCTION
x = y: y = r
LOOP
END FUNCTION
|
Posted by Charlie
on 2013-09-17 18:17:29 |