Những câu hỏi liên quan
zzzzz
Xem chi tiết
Quỳnh Chi Nguyễn
Xem chi tiết
Nguyễn Lê Phước Thịnh
25 tháng 1 2021 lúc 19:03

uses crt;

var n,kt,snt,b,m:longint;

{-----------------------------}

procedure nhap(var a:longint);

begin   

write('nhap n:'); readln(a);

end;

{-------------------------------------------}

function ktnt(var x:longint):integer;

var kt,i,kt1,j:integer;

begin   

kt:=0;   

for i:=2 to trunc(sqrt(x)) do     

if x mod i=0 then

begin                         

kt:=1;                         

break;                       

end;   

if kt=0 then ktnt:=1   

else ktnt:=0;

end;

{-----------------------------------------------------}

BEGIN   

clrscr;   

nhap(n);   

for m:=10 to n do   

{-----------------------------------------------}   

begin     

begin       

b:=m;     

repeat         

kt:=ktnt(b);         

if kt=0 then break         

else b:=b div 10;     

until b<10;     

if (ktnt(b)=1) and (b>1) then write(m,' ')     

end;   

end; 

{-------------------------------------------------}

readln;

END.

Bình luận (0)
Ngô Thị Tân
Xem chi tiết
Nguyễn Hoàng Duy
12 tháng 12 2023 lúc 20:17

Pascal hay C++

Bình luận (0)
Nguyễn Văn Tiến Dũng
Xem chi tiết
Phía sau một cô gái
13 tháng 8 2023 lúc 8:49

program KiemTraSoSieuNguyenTo;

uses crt;

function IsPrime(num: integer): boolean;

var

   i: integer;

begin

   if num < 2 then

      IsPrime := false

   else

   begin

      IsPrime := true;

      for i := 2 to trunc(sqrt(num)) do

      begin

         if num mod i = 0 then

         begin

            IsPrime := false;

            break;

         end;

      end;

   end;

end;

function IsSuperPrime(num: integer): boolean;

var

   i, temp: integer;

begin

   IsSuperPrime := true;

   while num > 0 do

   begin

      if not IsPrime(num) then

      begin

         IsSuperPrime := false;

         break;

      end;

      temp := num mod 10;

      num := num div 10;

   end;

end;

var

   n: integer;

   inputFile, outputFile: text;

begin

   assign(inputFile, 'SNT.INP');

   assign(outputFile, 'SNT.OUT');

   reset(inputFile);

   rewrite(outputFile);

   readln(inputFile, n);

   if IsSuperPrime(n) then

      writeln(outputFile, 1)

   else

      writeln(outputFile, 0);

   close(inputFile);

   close(outputFile);

end.

Bình luận (1)
Nguyễn Hoàng Duy
14 tháng 8 2023 lúc 6:42

const fi='SNT.INP'
   fo='SNT.OUT'
var n:qword;
function isPrimeNumber(n:qword):byte;
var i:longint;
begin
   if n<2 then exit(0);
   for i:=2 to trunc(sqrt(n))do
      if n mod i=0 then exit(0);
   exit(1);
end;
function isSuperPrimeNumber(n:qword):byte;
begin
   while n<>0 do
      begin
         if isPrimeNumber(n)=0 then exit(0);
         n:=n div 10;
      end;
   exit(1);
end;
begin
   assign(input,fi);reset(input);
   assign(output,fo);rewrite(output);
      readln(n);
      write(isSuperPrimeNumber(n));
   close(output);
   close(input);
end.

 

Bình luận (0)
Pham Trong Bach
Xem chi tiết
Cao Minh Tâm
31 tháng 7 2019 lúc 18:11

Đáp án A

Ta có

Do đó số chữ số của số đó là 2098959 + 1 = 2098960

Bình luận (0)
Pham Trong Bach
Xem chi tiết
Cao Minh Tâm
19 tháng 10 2019 lúc 14:28

Đáp án A

Ta có

log M 6972593 = log 2 6972593 − 1 ≈ log 2 6972593 = log 2 log 2 10 6972593 log 2 10 = 6972593 log 2 10 = 2098959 , 641

Do đó số chữ số của số đó là

2098959 + 1 = 2098960

Bình luận (0)
Nguyễn Thu Hà
Xem chi tiết
Nguyễn Lê Phước Thịnh
10 tháng 12 2020 lúc 22:30

uses crt; var a,b:array[1..100000]of integer;     i,n,kt,j,dem,x,y,kt1:integer;     st,st1:string; begin clrscr; write('Nhap n='); readln(n); for i:=1 to n do   begin      write('A[',i,']='); readln(a[i]);   end; dem:=0; for i:=1 to n do   if a[i]>1 then      begin         kt:=0;         for j:=2 to a[i]-1 do           if a[i] mod j=0 then              begin                 kt:=1;                 break;              end;         if kt=0 then            begin               inc(dem);               b[dem]:=a[i];            end;      end; for i:=1 to dem do   begin      str(a[i],st);      st1:=''      for j:=length(st) downto 1 do        st1:=st1+st[j];      val(st1,x,y);      kt1:=0;      for j:=2 to x-1 do        if x mod j=0 then           begin              kt1:=1;              break;           end;      if kt1=0 then write(a[i]:4);   end; readln; end.

Bình luận (0)
Nguyễn Thu Hà
Xem chi tiết
Nguyễn Lê Phước Thịnh
10 tháng 12 2020 lúc 22:26

uses crt; var a,b:array[1..100000]of integer;     i,n,kt,j,dem,x,y,kt1:integer;     st,st1:string; begin clrscr; write('Nhap n='); readln(n); for i:=1 to n do   begin      write('A[',i,']='); readln(a[i]);   end; dem:=0; for i:=1 to n do   if a[i]>1 then      begin         kt:=0;         for j:=2 to a[i]-1 do           if a[i] mod j=0 then              begin                 kt:=1;                 break;              end;         if kt=0 then            begin               inc(dem);               b[dem]:=a[i];            end;      end; for i:=1 to dem do   begin      str(a[i],st);      st1:=''      for j:=length(st) downto 1 do        st1:=st1+st[j];      val(st1,x,y);      kt1:=0;      for j:=2 to x-1 do        if x mod j=0 then           begin              kt1:=1;              break;           end;      if kt1=0 then write(a[i]:4);   end; readln; end.

Bình luận (0)
Nguyễn Hoàng Nam
Xem chi tiết
Ngô Quang Sinh
10 tháng 3 2017 lúc 17:17

Câu sai: B, D, E.

Câu đúng: A, C.

Bình luận (0)