Did my homework. My initial concept was to have 2 nested loops, one to list the numbers 1100 and another to see if it was divisible by any number from 2 to one less than that number. However, this listed all numbers (not necessarily prime) that did not have all the factor 2 to that number. For example, 14 showed up on this list because 3 was not a factor although it is not prime. I came up with another idea of counting how many factors the tested number had. If it was prime, the number of factors would be 0. Within the nested loop, I tested every number from 2 to that number, but this time, add 1 to a variable to count the factors. If the number of factors=0, it would draw the number.

AuthorHere's where I put stuff about my life and what I'm doing! Archives
January 2014
Categories 