![]() |
![]() |
| Paypal | FTP | CCD | Buscar | Trucos | Trabajo | Foros |
|
#9
|
|||
|
|||
|
ignorar mi respuesta anterior, se me ha ido la mano cuando estaba revisando el código de marto.
para solucionar, pongo el código depurado que incluye el dos como primo function EsPrimo(N: Integer): Boolean; var temp, i: integer; enc: boolean; begin i := 3; enc := N and 1 = 0;//es par while (i < N - 1) and not Enc do begin temp := N; while Temp > 0 do Temp := Temp - i; if Temp = 0 then enc := true; i := i + 2; end; result:=(not Enc) or (N=2); end; |
|
|
|