| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Spitfire Onboard Radar? |
-> i have experianced almost the same type of thing... i wrote a program years
-> to find what i call Pythagorean Triples... they are the A, B, and C in
-> A^2+B^2=C^2... 3 4 5 being the first set... back then, it took many hours fo
-> those up to 100 to be found... on today's machines, that run is over in
-> seconds... i've adjusted the program over the years and run it every once in
-> while just for fun and it still takes only seconds for it to find the triple
-> up to the highest it can count in that language...
-> )\/(ark
Just for the hell of it, I wrote the following little thing in QBasic.
It finds the triples, in order - shortest side, middle side, with the
hypotenuse being whatever it comes out to be. Similar triangles are NOT
printed. For example, once the thing has found 3,4,5, it ignores
6,8,10, 9,12,15, etc..
The first time I tried it, I DIMmed the arrays to hold the same number
of values as the maximum length of the shortest side. I tried it with
that number being 100. Interestingly, the arrays were *exactly* full
when it finished, so there are exactly 100 non-similar Pythagorean
triangles in which the shortest side is 100 units or less.
Some nice ones show up, such as 119,120,169. I like these triangles in
which the two shorter sides are almost equal. Too many Pythagorean
triangles are very long and skinny!
dow
-----------------------------------------------------
DEFLNG A-Z
L = 150
P = 0
CLS
DIM A(1 TO 2 * L), B(1 TO 2 * L)
FOR A = 1 TO L
AA = A * A
B = A + 1
DO
C# = SQR(AA + B * B)
C = C#
IF C = C# THEN
F = 1
FOR Q = 1 TO P
IF A / A(Q) = B / B(Q) THEN F = 0: EXIT FOR
NEXT
IF F THEN
PRINT A, B, C
P = P + 1
A(P) = A
B(P) = B
END IF
END IF
B = B + 1
LOOP UNTIL C# <= B
NEXT
PRINT "Number:"; P
END
---------------------------------------------------
--- Platinum Xpress/Win/WINServer v3.0pr5
* Origin: The Bayman BBS,Toronto, (416)698-6573 - 1:250/514 (1:250/514)SEEN-BY: 633/267 270 @PATH: 250/514 123/500 106/2000 633/267 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.