WeChall - Prime Factory
Your task is to find the first two primes above 1,000,000 whose digit sum is also prime. 你的任务是找到大于1,000,000的前两个质数,其各位数字之和也是质数。
Challenge
Find the first two primes greater than 1,000,000 where the sum of their digits is also prime. Concatenate them as the answer.
Solution
1 | def is_prime(n): |
The first two primes are 1000033 and 1000037. Their digit sums are 1+0+0+0+0+3+3 = 7 (prime) and 1+0+0+0+0+3+7 = 11 (prime). Concatenated: 10000331000037.