Skip to content

Commit

Permalink
Update algorytmy_wymagania.md
Browse files Browse the repository at this point in the history
Fixed code - is_prime(x) and pseudocode - is_prime(x)

Signed-off-by: Wernex <75118593+wernexnrs@users.noreply.github.com>
  • Loading branch information
wernexnrs committed May 28, 2024
1 parent 24b570b commit 4b24660
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions dzialy/algorytmy_wymagania.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,26 +110,29 @@ def to_base(n, b):

```python
def is_prime(x):
if x > 1:
for i in range(2, int(x**0.5)):
if x % i == 0:
return False
return True
return False
if x <= 1:
return False
for i in range(2, int(x**0.5) + 1):
if x % i == 0:
return False
return True
```
<b>

```
A <- [1,2 … n]
Funkcja is_prime(x):
Jeżeli x <= 1
Zwróć Fałsz
Koniec jeżeli
Dla i = 1,2 … n
Jeżeli i > 1
Dla j = 2,3 ... i
Jeżeli i mod j == 0
Zwróć Fałsz
Zwróć Prawde
W innym wypadku
Zwróć Fałsz
Dla i od 2 do całkowitej wartości (pierwiastek kwadratowy z x) + 1:
Jeżeli x mod i == 0
Zwróć Fałsz
Koniec jeżeli
Koniec dla
Zwróć Prawda
Koniec funkcji
```
</b>
</details>
Expand Down

0 comments on commit 4b24660

Please sign in to comment.