new file: "3. \303\234bungen/12.09.2022/Problem_48.py"

new file:   "3. \303\234bungen/12.09.2022/Problem_48_home.py"
	new file:   output.txt
This commit is contained in:
2022-09-13 12:14:13 +02:00
parent 1fa3869c6c
commit 452659706e
3 changed files with 77 additions and 0 deletions

View File

@ -0,0 +1,20 @@
# 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
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 ist_Quadratzahl(i+1) and ist_Quadratzahl(i/2+1):
print(i)
i+=1

View File

@ -0,0 +1,34 @@
# 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