Amicable pairs: Difference between revisions

Content deleted Content added
Ssmitch45 (talk | contribs)
No edit summary
Ssmitch45 (talk | contribs)
Line 303: Line 303:
<lang algol60>
<lang algol60>
begin
begin

comment - return p mod q;
comment - return p mod q;
integer procedure mod(p, q);
integer procedure mod(p, q);
Line 310: Line 311:
end;
end;


comment - return the sum of the proper divisors of n;
comment - return sum of the proper divisors of n;
integer procedure sumf(n);
integer procedure sumf(n);
value n; integer n;
value n; integer n;
Line 332: Line 333:
comment - main program begins here;
comment - main program begins here;
integer a, b, c;
integer a, b, c;
outstring(1,"Searching up to 10000 for amicable pairs\n");
outstring(1,"Searching up to 20000 for amicable pairs\n");
for a := 2 step 1 until 10000 do
for a := 2 step 1 until 20000 do
begin
begin
b := sumf(a);
b := sumf(a);
Line 354: Line 355:
<pre>
<pre>
Searching up to 20000 for amicable pairs
Searching up to 20000 for amicable pairs
220 284
220 284
1184 1210
1184 1210
2620 2924
2620 2924
5020 5564
5020 5564
6232 6368
6232 6368
10744 10856
10744 10856
12285 14595
12285 14595
17296 18416
17296 18416
That's all. Goodbye.
That's all. Goodbye.