Program DZ;
var n,i,k,j,f:longint;
a:array [1..10000] of longint;
begin
k:=0;
read (n);
a[1]:=1;
a[2]:=1;
for i:=3 to 10000 do
begin
if not(a[i-1] < n) then
begin
break
end;
a[i]:=a[i-1]+a[i-2];
k:=k+1
end;
for i:= 1 to k do
begin
f:=0;
for j:=2 to a[i]-1 do
if a[i] mod j=0 then f:=1;
if f=0 then write (a[i],' ');
end;
end.
Это для Pascal