Created
February 24, 2013 20:13
-
-
Save jermenkoo/5025405 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
program domaca; | |
{$APPTYPE CONSOLE} | |
uses | |
SysUtils; | |
var p : array of boolean; | |
i, j, m, N : integer; | |
begin | |
readln(N); | |
SetLength(p, N); | |
for i := 1 to N do p[i] := true; | |
m := round(sqrt(N)); | |
for i := 2 to m do begin | |
if p[i] then | |
for j := 2 to N div i do p[i * j] := false; | |
end; | |
for i := 2 to N do if p[i] then writeln(i); | |
readln; | |
end. | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment