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
master
Rsclub22 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

23
output.txt Normal file
View File

@ -0,0 +1,23 @@
2022-09-13 11:23:33,129: 48
2022-09-13 11:23:33,129: 1680
2022-09-13 11:23:33,129: 57120
2022-09-13 11:23:33,130: 1940448
2022-09-13 11:23:33,135: 65918160
2022-09-13 11:23:33,159: 2239277040
2022-09-13 11:23:33,306: 76069501248
2022-09-13 11:23:34,146: 2584123765440
2022-09-13 11:23:39,077: 87784138523760
2022-09-13 11:24:07,549: 2982076586042448
2022-09-13 11:32:51,334: 48
2022-09-13 11:32:51,334: 1680
2022-09-13 11:32:51,335: 57120
2022-09-13 11:32:51,336: 1940448
2022-09-13 11:32:51,341: 65918160
2022-09-13 11:32:51,366: 2239277040
2022-09-13 11:32:51,506: 76069501248
2022-09-13 11:32:52,320: 2584123765440
2022-09-13 11:32:57,098: 87784138523760
2022-09-13 11:33:24,936: 2982076586042448
2022-09-13 11:34:14,228: 17380816062160328
2022-09-13 11:35:05,575: 43707861882448008
2022-09-13 11:35:26,777: 58106601358565880