[This article was first published on Xi'an's Og » R, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

The current puzzle in Le Monde this week is again about prime numbers:

The control key on a credit card is an integer η(a) associated with the card number a such that, if the card number is c=ab, its key η(c) satisfies η(c)=η(a)+η(b)-1. There is only one number with a key equal to 1 and the keys of 160 and 1809 are 10 and 7, respectively. What is the key of 2010?

The key of 1 is necessarily 1 since

η(a1)=η(a)+η(1)-1=η(a).

So this eliminates 1. Now, the prime number decompositions of 160, 1809, and 2010 are given by

> prime.factor(160)
 2 2 2 2 2 5
> prime.factor(1809)
  3  3  3 67
> prime.factor(2010)
  2  3  5 67

using a function of the (still bugged!) schoolmath package. We thus have the decompositions

5η(2)+η(5)=11

3η(3)+η(67)=8

Since η(2) cannot be 1 and is an integer, we necessarily have η(2)=2 but then this implies η(5)=1 (!), unless 0 is also a valid key (?), which would imply that η(5)=11. With the same constraint on 1, the second sum also leads to the unique solution η(3)=2 and η(67)=2. I thus wonder if there is a bug in the key of 160…

Filed under: R, University life Tagged: Le Monde, mathematical puzzle, schoolmath        To leave a comment for the author, please follow the link and comment on their blog: Xi'an's Og » R.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

# Never miss an update! Subscribe to R-bloggers to receive e-mails with the latest R posts.(You will not see this message again.)

Click here to close (This popup will not appear again)