Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions Уроки/1/код/t25.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#первый факториал, количество цифр которого равно 1000
from math import ceil, log10
a, b = 0, 1
i = 0
while 1:
i += 1
a, b = b, a + b
if ceil(log10(a)) == 1000:
break
print(i)
21 changes: 21 additions & 0 deletions Уроки/1/код/t41.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import itertools

#проверка на простое число
def isPrime(n):
if n % 2 == 0:
return n == 2
d = 3
while d ** 2 <= n and n % d != 0:
d += 2
return d ** 2 > n

#вернет самое большое простое пан-число
def getMaxPrPand(s):
for n in range(10,1,-1):
for i in itertools.permutations(s,n):
if isPrime(int(''.join(i))):
return (''.join(i))

print(getMaxPrPand("7654321"))


11 changes: 11 additions & 0 deletions Уроки/1/код/t9.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from math import sqrt

#вернет произведение пифагорейских чисел, чья сумма равна 1000
def getMulThPifo():
for a in range(1,1000):
for b in range(1,1000):
c = sqrt(a**2+b**2)
if a + b + c == 1000:
return int(a*b*c)

print(getMulThPifo())