aboutsummaryrefslogtreecommitdiff
path: root/challenge-158/duncan-c-white/README
blob: becee387dcecda80c4c4d26033069e4f52c20edf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
TASK #1 - Additive Primes

Write a script to find out all Additive Primes <= 100.

Additive primes are prime numbers for which the sum of their decimal
digits are also primes.

Output

	2, 3, 5, 7, 11, 23, 29, 41, 43, 47, 61, 67, 83, 89

MY NOTES: ok.  Pretty easy.  Reuse my MakePrimes module, and code up
isprime(n) and isprime(sum_digits(n))


TASK #2 - First Series Cuban Primes

Write a script to compute first series Cuban Primes <= 1000. Please
refer to https://en.wikipedia.org/wiki/Cuban_prime
for more information.

[That says: p = (y+1)**3 - y**3 for y>0, or p = 3y**2 + 3y + 1 for y>0]

Output

	7, 19, 37, 61, 127, 271, 331, 397, 547, 631, 919.

MY NOTES: ok.  Not quite clear from Wikipedia page whether 3y**2 + 3y + 1
for all y>0 is prime, I assume that's not true, so that we have to check
isprime(3y**2 + 3y + 1)