Le Monde puzzle [#1124]
This article is originally published at https://xianblog.wordpress.com
A prime number challenge [or rather two!] as Le weekly Monde current mathematical puzzle:
When considering the first two integers, 1 and 2, their sum is 3, a prime number. For the first four integers, 1,2,3,4, it is again possible to sum them pairwise to obtain two prime numbers, eg 3 and 7. Up to which limit is this operation feasible? And how many primes below 30,000 can write as n^p+p^n?
The run of a brute force R simulation like
max(apply(apply(b<-replicate(1e6,(1:n)+sample(n)),2,is_prime)[,b[1,]>2],2,prod))
provides a solution for the first question until n=14 when it stops. A direct explanation is that the number of prime numbers grows too slowly for all sums to be prime. And the second question gets solved by direct enumeration using again the is_prime R function from the primes package:
[1] 1 1 [1] 1 2 [1] 1 4 [1] 2 3 [1] 3 4
Thanks for visiting r-craft.org
This article is originally published at https://xianblog.wordpress.com
Please visit source website for post related comments.