new file: "3. \303\234bungen/12.09.2022/Problem_48_home.py" new file: output.txt
35 lines
718 B
Python
35 lines
718 B
Python
# Programm, welches das Problem "48" bearbeitet
|
|
# also überprüft, ob der Nachfolger einer zahl
|
|
# und der Nachfolger der Hälfte der Zahl jeweils Quadratzahlen sind
|
|
import logging
|
|
logging.basicConfig(filename='output.txt', level=logging.DEBUG, format='%(asctime)s: %(message)s')
|
|
|
|
def ist_Quadratzahl(n):
|
|
if (n**(1/2)== int(n**(1/2))):
|
|
return True
|
|
else:
|
|
return False
|
|
|
|
|
|
'''
|
|
# Hier ist normales Programm
|
|
|
|
i=1
|
|
|
|
while True:
|
|
if i%2==0:
|
|
if ist_Quadratzahl(i+1) and ist_Quadratzahl(i/2+1):
|
|
#print(i)
|
|
logging.debug(i)
|
|
i+=1
|
|
'''
|
|
|
|
i=2
|
|
|
|
while True:
|
|
iq = i**2
|
|
if (iq-1) % 2 == 0:
|
|
if ist_Quadratzahl((iq+1)/2):
|
|
logging.debug(iq-1)
|
|
i+=1
|