summaryrefslogtreecommitdiff
path: root/day1/exercise/arms.py
blob: 33196fd508d77ff9ef8d008b61557c758391fc68 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# Armstrong Numbers

for n in range(100, 1000):
#    s = str(n)
#    a, b, c = int(s[0]), int(s[1]), int(s[2])
#    if a * a * a + b * b * b + c * c * c == n:
#       print n
#   sum, copy = 0, n    
#   while copy > 0:
#       sum += (copy % 10) ** 3
#       copy /= 10
#   if sum == n:
#      print n
    u = n % 10
    h = n / 100
    t = (n/10) % 10
    if h ** 3 + t ** 3 + u ** 3 == N:
        print n