Amicable pairs: Difference between revisions
Content deleted Content added
Line 332: | Line 332: | ||
comment - main program begins here; |
comment - main program begins here; |
||
integer a, b, c; |
integer a, b, c, found; |
||
outstring(1,"Searching up to 20000 for amicable pairs\n"); |
outstring(1,"Searching up to 20000 for amicable pairs\n"); |
||
found := 0; |
|||
for a := 2 step 1 until 20000 do |
for a := 2 step 1 until 20000 do |
||
begin |
begin |
||
Line 342: | Line 343: | ||
if a = c then |
if a = c then |
||
begin |
begin |
||
found := found + 1; |
|||
outinteger(1,a); |
outinteger(1,a); |
||
outinteger(1,b); |
outinteger(1,b); |
||
Line 348: | Line 350: | ||
end; |
end; |
||
end; |
end; |
||
outinteger(1,found); |
|||
outstring(1," |
outstring(1,"pairs were found"); |
||
end |
end |
||
Line 363: | Line 366: | ||
12285 14595 |
12285 14595 |
||
17296 18416 |
17296 18416 |
||
8 pairs were found |
|||
That's all. Goodbye. |
|||
</pre> |
</pre> |
||