Initial release

This commit is contained in:
Francois JUMELLE
2021-05-03 22:32:40 +02:00
commit 20526d93c8
928 changed files with 452368 additions and 0 deletions

19
Les nombres heureux.py Normal file
View File

@@ -0,0 +1,19 @@
mini = 8962
maxi = 9189
def is_happy(n):
table = list()
while len(str(n))>1:
n = str(sum([int(i)**2 for i in str(n)]))
if n in table:
break
else:
table.append(n)
return n=="1"
solution = list()
for i in range(mini, maxi+1):
if is_happy(i):
solution.append(i)
print(solution)