Skip to content

# Khan/khan-exercises

### Subversion checkout URL

You can clone with HTTPS or Subversion.

Newer
Older
100644 53 lines (45 sloc) 2.078 kb
 af417c3 Add prime numbers marcia authored May 17, 2011 1 2 3 4 Prime Numbers 5 6 7 8
9 getPrime() 10 getFactors( PRIME ).join( ", " ) 11 12 14 getOddComposite() 15 getFactors( WRONG_1 ).join( ", " ) 16 17 getOddComposite() 18 getFactors( WRONG_2 ).join( ", " ) 19 20 getOddComposite() 21 getFactors( WRONG_3 ).join( ", " ) 22 23 getEvenComposite() 24 getFactors( WRONG_4 ).join( ", " ) 25 26
27 28
29
30

Which of these numbers is prime?

31

PRIME

32 33
34
• WRONG_1
• 35
• WRONG_2
• 36
• WRONG_3
• 37
• WRONG_4
• 38
39
40
41 42
43

A prime number has exactly two factors: 1 and itself.

44

The factors of WRONG_1 are WRONG_1_FACTORS.

45

The factors of WRONG_2 are WRONG_2_FACTORS.

46

The factors of WRONG_3 are WRONG_3_FACTORS.

47

The factors of WRONG_4 are WRONG_4_FACTORS.

48

The factors of PRIME are PRIME_FACTORS.

49

Thus, PRIME is a prime number.

50 51
52 53
Something went wrong with that request. Please try again.