Hacker Timesnew | past | comments | ask | show | jobs | submitlogin

An old math teacher of mine gave me this fun little problem: For each number n from 1 to 9, make 6 from three copies of n, using only basic-ish arithmetic and no other numbers. For example, 2+2+2 = 6. I will leave the rest as a puzzle for the reader.

Precise statement of restrictions (enumerating these may give you a bit of a hint): You're allowed to use these operators: + - * / √ !

I did this, and then I figured out that if you're allowed to use the floor function as well, you can fulfill this task for any n ≥ 1. If [x] denotes the floor of x, then I'll demonstrate with 56:

√56 is somewhat less than 8. √√56 is somewhat less than 3. √√√56 is somewhat less than 2. Then [√√√56] = 1. Thus, we can have: ([√√√56]+[√√√56]+[√√√56])! = 3! = 6.

The expression to find "number of times you'll have to take square root of n" is slightly interesting: we want to take k square roots and end up with something less than 2, so n^(1/2^k) < 2, or n < 2^(2^k), so k > log_2(log_2(n)).



This reminds me of Knuth's conjecture. http://www.perlmonks.org/?node_id=443037 (Starting with 3, apply some combination of factorial, square root, and floor functions. Knuth conjectured all natural numbers are achievable this way.)


That's indeed a fun little problem, thanks!

For the lazy, solutions are at http://pastebin.com/XJZTFGHP


Nice. I had some slightly different solutions in mind, which I have added: http://pastebin.com/TeBPHbb6


Yes, I enjoyed that diversion quite a bit.

A few different solutions: http://pastebin.com/Mf6ZmhfA


Of course, performing more square roots than necessary won't hurt.


What was the solution for n = 1?


(1+1+1)! = 3! = 6 as the parent comment suggested.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: