Le Monde puzzle [#1109]

A digital problem as Le Monde current mathematical puzzle:

Noble numbers are such that they only involve different digits and are multiple of all their digits. What is the largest noble number?

Hmmmm…. Brute force? Since the maximal number of digits is 10, one may as well try:

k=soz=9
for (t in 1:1e3){
sol=1
while (sol<10^(k-1)){ 
 u=sample(0:8,k);i=digit2int(u) 
 if (max(i%%u[u>0])==0) soz=max(soz,sol<-i)}}

which returns 9875643120… (I made the conscious choice to exclude zero from the dividers. Which was not a choice spelled out in the original question.)

5 Responses to “Le Monde puzzle [#1109]”

  1. […] by data_admin [This article was first published on R – Xi’an’s Og, and kindly contributed to R-bloggers]. (You can report issue about the content on this page […]

  2. carl witthoft Says:

    I think this is faster, and removes the chance that your “sample()” misses the winning value. (since we know the winner must end in an even digit followed by zero, I reduced the set of numbers for which we check divisibility)

    flag = 0
    startat = 987654312
    getmax = 0
    while (!flag){
    getmax = max(startat%%c(2,3,6,7,8,9))
    if (getmax == 0) {
    # first see if it’s got repeated digits
    sstr = unlist(strsplit(toString(startat),split=NULL) )
    if (length(unique(sstr)) == length(sstr) ) flag = 1
    } else startat = startat -1 # so don’t decrement if exiting
    if ( startat == 0) {
    flag = 1
    cat(‘startat is zero’)
    }
    }

  3. 9876351240 Says:

    Nice approach… what about biasing larger digits? (e.g. sample(0:9, 10, prob = (1:10)/55) )

    If one’s got time, iterating logic could be changed to: while(sol < soz)

    Building on the above, there's simple (but tedious to implement) heuristic to adapt sampling to new maximums — an overkill for this problem, but useful in generalizing this approach.

  4. carl witthoft Says:

    OK, now solve it in a N-character numeric system. Brute force in base-60 might be tough :-) . I wonder what theorems exist for bounds on Noble numbers vs. base.

  5. […] article was first published on R – Xi'an's Og, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here) […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.