[Problem & Solution]
TIME : DIGITS SUMMARY 15
Find all times whose digits add up to 15. Only hour and minute values will be taken into account. For example; 09:42 -> 9+4+2=15 or 23:55 -> 2+3+5+5=15, etc.
There is an interesting mathematical rule in this serie. I rest it you to find.
I am giving Python code to find all solutions:
h = 0
m = 0
sh = ""
sm = ""
for i in range(24):
sh = str(i)
h = 0
for a in range(len(sh)):
h += int(sh[a])
for j in range(60):
m = 0
sm = str(j)
for a in range(len(sm)):
m += int(sm[a])
if h + m == 15:
print(i,":",j, end=", ")
Info: All codes are written and solutions found by myself in this site.
Ali Eskici
13.10.2024