Data update
This commit is contained in:
parent
35bcdeebf8
commit
74c69a0df6
2427 changed files with 31826 additions and 3468 deletions
19
Task/Euclid-Mullin-sequence/SETL/euclid-mullin-sequence.setl
Normal file
19
Task/Euclid-Mullin-sequence/SETL/euclid-mullin-sequence.setl
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
program euclid_mullin;
|
||||
print(2);
|
||||
product := 2;
|
||||
loop for i in [2..16] do
|
||||
next := smallest_factor(product + 1);
|
||||
product *:= next;
|
||||
print(next);
|
||||
end loop;
|
||||
|
||||
op smallest_factor(n);
|
||||
if even n then return 2; end if;
|
||||
d := 3;
|
||||
loop while d*d <= n do
|
||||
if n mod d=0 then return d; end if;
|
||||
d +:= 2;
|
||||
end loop;
|
||||
return n;
|
||||
end op;
|
||||
end program;
|
||||
Loading…
Add table
Add a link
Reference in a new issue