A mathematical professor set his lock number, he used mathematics so he would remember the ten digit code. He used all of the digits from 0-9, every digit only once. In his mind the first two digits of the code became a two-digit-number (XX). If you multiply this number (by some integer), you get a three-digit-number (YYY), which is formed by the 3rd, 4th and 5th digits of the code. And lastly, if you multiply the first (two-digit-number) with a second (three-digit-number), you get the remaining five digits of the code (five-digit-number).

In other words, we're looking for



XX * ? = YYY

And all digits are unique.

  • 2
    $\begingroup$ Could you clarify the question a bit? You wrote "...in his mind the first two numbers of the code became a two-digit-number. If you multiply this number (by what?) you get a three-digit-number..." Are you looking for a solution where you square the first two numbers to get the next three? Are you looking for a solution where you double the first two number to get the next three? $\endgroup$ – Hugh Sep 4 '18 at 17:35
  • $\begingroup$ Also, are we allowed to insert leading zeroes? For example, if the two digit number XX times the three digit number XXX, and we get a four digit answer, can we put a 0 in front of it to make it 5 digits? $\endgroup$ – Hugh Sep 4 '18 at 17:53
  • 1
    $\begingroup$ @Dejan Pivk, Welcome to PSE. When you say "I would like to find the answer to", does that mean you don't know the answer to the question? Did you create this puzzle yourself, or did you find it somewhere? $\endgroup$ – nikki Sep 4 '18 at 17:58

Feel a little bit bad because I just brute-forced it but:



The two digit number is 27. If you multiply this number (specifically by 22) you can get 594. 27 * 594 = 16,038. All these numbers appended together makes 2759416038 which is a ten digit number that uses each digit only once. It is also the only such number that fits all the prescribed rules.

| improve this answer | |
  • $\begingroup$ Awww what? I just ran my program to solve that :( $\endgroup$ – Rohit Jose Sep 4 '18 at 18:28

I assumed that "multiply this [two-digit] number" means "multiply it by something unknown" and wrote a simple program to see what this unknown could be. I only found one possible value of this unknown:

The statement will read "multiply this number by 22".

In this case the answer is:

2759416038: 27 * 22 = 594, 27 * 594 = 16038

| improve this answer | |

If I understood the riddle correctly we should find ten numbers (a combination for the lock). The first two numbers form a two digit number which multiplied with it self should form another three digit number. And the two-digit number multiplied with the three digit number should form the full lock combination.



XX XXX XXXXX = combination key

| improve this answer | |
  • 1
    $\begingroup$ That's what I thought originally too, but that interpretation has no solutions. The only way I could interpret the riddle to return just one solution is that the first two digit number has to be multiplied by some integer to get the next three digit number. $\endgroup$ – Luke C. J. Currie Sep 4 '18 at 19:53
  • $\begingroup$ Yup, I think your solution might be just right. Thank you btw. $\endgroup$ – JackNicholson Sep 4 '18 at 20:00

Checking all possible solutions for this riddle, finally receiving:

XX: 27 , YYY: 594 , ZZZZZ: 16038

for(i in x){
  for(j in x){
      tmpyyy<-tmp[which(!is.element(tmph,c(i,j)) & !is.element(tmpz,c(i,j)) & !is.element(tmpe,c(i,j)) & tmph!=tmpz & tmph!=tmpe &tmpe!=tmpz & tmp>99 & tmp<1000)]
      tmpzzzzz<-tmp[which(!is.element(tmp2zt,c(i,j)) &!is.element(tmp2t,c(i,j)) & !is.element(tmp2h,c(i,j)) & !is.element(tmp2z,c(i,j)) & !is.element(tmp2e,c(i,j)) & tmp2h!=tmp2z & tmp2h!=tmp2e &tmp2e!=tmp2z & tmp2e!=tmp2t &tmp2e!=tmp2zt &tmp2t!=tmp2z&tmp2zt!=tmp2z &tmp2h!=tmp2t &tmp2h!=tmp2zt &tmp2t!=tmp2zt & tmp>9999 & tmp<100000)]
      if(length(tmpyyy)>0 & length(tmpzzzzz)>0){
        for(y in tmpyyy){
          tmpres<-tmpzzzzz[which(!is.element(tmp2zt,c(tmph,tmpz,tmpe))& !is.element(tmp2t,c(tmph,tmpz,tmpe)) & !is.element(tmp2h,c(tmph,tmpz,tmpe))&!is.element(tmp2z,c(tmph,tmpz,tmpe)) & !is.element(tmp2e,c(tmph,tmpz,tmpe))& ((i*10+j)*y==tmpzzzzz))]
            cat(paste("XX:",(i*10+j), ", YYY:",y, ", ZZZZZ:",tmpres))
| improve this answer | |
  • $\begingroup$ Hey, you missed the constrain that that the xx multiplied by yyy makes zzzzz $\endgroup$ – Ontamu Sep 5 '18 at 8:41
  • $\begingroup$ Thanks. I recoded it now which reduced the possible solutions. $\endgroup$ – Alex2006 Sep 5 '18 at 8:53
  • $\begingroup$ You might still have some debugging to do on the code. 54*216 = 11664 not 37908. I believe you will end up with only 1 solution if find the error in the code. $\endgroup$ – Ontamu Sep 5 '18 at 8:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.