Skip to content

Instantly share code, notes, and snippets.

@kylelk
Created August 21, 2013 22:45
Show Gist options
  • Save kylelk/6301186 to your computer and use it in GitHub Desktop.
Save kylelk/6301186 to your computer and use it in GitHub Desktop.
Shows the number of divisors for each number less than 100. shows in bar graph format.
#
# divisors.py
#
#
# Created by Kyle Kersey on 8/19/13 4:33 PM.
#
#
b=1
d = 0
#generates a list of numbers.
while b<100:
b=b+1
x = 0.0
a = 0
#generates a list of numbers less than b.
while x<b:
x=x+1
#this will check for divisors.
if (b/x)-int(b/x) == 0.0:
a=a+1
print b, a*"-"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment