Advertisement
Apauldin

4

Sep 29th, 2021
1,189
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var s, i, a , b, j, cnt, n, d: Integer;
  2. begin
  3. s:=2;
  4.   a:=4099;
  5.   b:= 26985;
  6.   s := 0;
  7.   for i:=a to b do begin
  8.     cnt := 0;
  9.     d := 2;
  10.     while (((d * d) < i)) do begin
  11.       if (i mod d = 0) then begin
  12.         cnt := cnt + 2;
  13.       end;
  14.       d:=d + 1;
  15.     end;
  16.     if ((cnt = 0) and (d * d = i)) then begin
  17.       n:= i;
  18.       while (n > 0) do begin
  19.         s:= s + (n mod 10);
  20.         n:= n div 10;
  21.       end;
  22.     end;
  23.   end;
  24.   writeln(s);
  25. end.
  26.  
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement