program is_super_simple_program; uses crt; var input_number,perest_count: integer; prestanovki : Array [1..30000] of integer; {----------------------------------------} function is_simple(number:integer):boolean; var i,j: integer; begin is_simple := true; for i:=2 to number-1 do begin if (number mod i) = 0 then begin is_simple := false; break; end; end; end; {----------------------------------------} function is_perestanovka(x,y,rozradnist:integer):boolean; var finder : boolean; cifriX,cifriY : Array [1..10] of integer; i,j: integer; begin is_perestanovka := true; for i:=1 to 10 do begin cifriX[i] := 0; cifriY[i] := 0; end; for j:=rozradnist downto 1 do begin cifriX[(x mod 10)+1] := cifriX[(x mod 10)+1]+1; cifriY[(y mod 10)+1] := cifriY[(y mod 10)+1]+1; x := round(x/10); y := round(y/10); end; for i:=1 to 10 do begin if cifriX[i] <> cifriY[i] then is_perestanovka := false; end; end; {----------------------------------------} function is_super_simple(number:integer):boolean; var mnozhnik,bottom_num,top_num : integer; rozradnist : integer; i,j: integer; begin is_super_simple := true; mnozhnik := 1; rozradnist := 0; while (number/mnozhnik)>1 do begin mnozhnik := mnozhnik*10; rozradnist := rozradnist+1; end; bottom_num := round(mnozhnik/10); top_num := mnozhnik-1; for i:=bottom_num to top_num do begin if is_perestanovka(i,number,rozradnist) then begin if (not is_simple(i)) then is_super_simple := false; end; end; end; {----------------------------------------} Begin clrscr; write('Введiть число: '); readln(input_number); if input_number > 9999 then begin write('введене завелике число...'); end else begin if is_super_simple(input_number) then begin write('число ',input_number, ' супер просте!'); end else begin write(input_number, ' - не супер просте..'); end; end; End.