Skip to content

Instantly share code, notes, and snippets.

@erayarslan
Created November 30, 2012 01:05
Show Gist options
  • Save erayarslan/4173052 to your computer and use it in GitHub Desktop.
Save erayarslan/4173052 to your computer and use it in GitHub Desktop.
Armstrong Numbers // range 1-1000
for i in range(1, 1000):
t = i
u = len(str(i))
x = 0
while u != 0 :
b = i/pow(10,u-1)
i = i%pow(10,u-1)
u=u-1
x = x + pow(b,3)
i = t
if i == x:
print i
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment