Eleanor Dare Nice New Blog
Code and ideas
Wednesday, 22 June 2011
Find prime numbers/prime factors
simple algorithm to find prime numbers and prime factors
depending on the value of N
void setup() {
long N =463;
for (long i = 2 ; i <= N ; i++) {
while (N % i == 0) {
System.out.println(i);
N = N/i;
}
}
}
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment