Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Find the error, LOL :v
- Program Super_Prime;
- Uses crt;
- Var
- i: LongInt;
- Function Prime(n: Integer): Boolean;
- Var
- A: Array [1..1000000] of Boolean;
- P: Array [1..4] of Word;
- i, j: Integer;
- Begin
- Fillchar(A,sizeof(A),true);
- P[1]:=2; P[2]:=3; P[3]:=5; P[4]:=7;
- For i:=1 to 4 do
- For j:=2 to n div P[i] do
- A[P[i]*j]:=false;
- If A[n]=true then Prime:=true
- else Prime:=false;
- End;
- Function SuperPrime(i: Integer): Boolean;
- Var
- S: String;
- value, c: LongInt;
- Begin
- SuperPrime:=false;
- Str(i,S);
- Val(S,value,c);
- If Prime(value) then {5}
- Begin
- Delete(S,length(S),1);
- Val(S,value,c);
- If Prime(value) then {4}
- Begin
- Delete(S,length(S),1);
- Val(S,value,c);
- If Prime(value) then {3}
- Begin
- Delete(S,length(S),1);
- Val(S,value,c);
- If Prime(value) then {2}
- Begin
- Delete(S,length(S),1);
- Val(S,value,c);
- If Prime(value) then {1}
- SuperPrime:=true;
- End;
- End;
- End;
- End;
- End;
- Procedure Output;
- Begin
- For i:=10000 to 99999 do
- If SuperPrime(i)=true then
- Writeln(i);
- Readln;
- End;
- Begin
- Output;
- End.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement