mathlover987
Joined: 10 Jan 2011 Posts: 7
|
Posted: May 23, 2011 8:39 PM Post subject: using lists in programs |
|
|
Im trying to write a program that gives me all the prime numbers in a list. I want to create "prime number list" (we'll call it "a") that adds to itself. I want to basically do this:
2 and 3 are members of list "a"
b=5
If b/2 does not equal the greatest integer (int) of b/2 and b/3 does not equal the greatest integer of b/3
Then 5 is a member of "a"
Then b + 2 ->b
The program will loop and display all prime numbers. However, I'm not sure how to easily add numbers to lists or how to divide by all numbers in a list. If anyone could help that would be great. BTW this is not the complete program, just the basic idea for it. |
|