Special pythagorean triplet
Special pythagorean triplet is a draft programming task. It is not yet considered ready to be promoted as a complete task, for reasons that should be found in its talk page.
- Task
- The following problem is taken from Project Euler
Ring
<lang ring> load "stdlib.ring" see "working..." + nl
time1 = clock() for a = 1 to 1000
for b = a+1 to 1000 for c = b+1 to 1000 if (pow(a,2)+pow(b,2)=pow(c,2)) if a+b+c = 1000 see "a = " + a + " b = " + b + " c = " + c + nl exit 3 ok ok next next
next
time2 = clock() time3 = time2/1000 - time1/1000 see "Elapsed time = " + time3 + " s" + nl see "done..." + nl </lang>
- Output:
working... a = 200 b = 375 c = 425 Elapsed time = 497.61 s done...