That's... Basically useless. You can get almost any home number is under 100 clicks I can almost guarantee. Give me a number, any number and I'll show you
This sounds like just my sort of problem. I’ll edit this comment with my answer by tomorrow at this time.
Ok, so first a disclaimer: when I said it's "just my sort of problem" I meant that it's the kind of problem that interests me, not that I'm an expert. On paper I'm slightly more qualified to answer this than an average Joe, but I'm not an expert in number theory so I hope my answer doesn't disappoint the people looking for an expert solving this problem.
This is a harder problem than it seems at first glance. Even just using +7, -2, and *3, the ten billion phone numbers and branching possibilities make this unwieldy to solve by brute force or with any mathematics I know. It reminds me of problems to do with prime numbers or the Collatz Conjecture in the way that it seems easy to make reasonable assumptions and come to right-seeming answers, but actually proving anything is really hard. I'll walk you through my process.
My first attempt was to write a program to simply start with 0 and repeatedly add, subtract, and multiply, branching out. Theoretically this would eventually find the shortest way to get to every number. Initially, Java ran out of memory, but after adding more, it still ground to a halt a little after 20 operations in. I made some more changes for efficiency, but it still stalled before it reached even one percent of phone numbers. Maybe a supercomputer could do this, and multi-threading would probably help with this approach, but I don't have a supercomputer and I'm bad at multi-threading, so I abandoned this approach. I will note that when I played around with this method on smaller sets of numbers (basically finding all the phone numbers that started with a bunch of zeroes), each new round of operations slightly more than doubled the phone numbers that had been reached, until almost all the numbers had been found. At that point, the last few phone numbers took their sweet time trickling in. This change happened about 1/6 of the way through the final maximum number of operations. If that sidenote doesn't make sense, don't worry about it, I'm not totally sure what it means either.
Then I tried looking at it in base 3. u/Inter_Detective has a great comment below me going into this method, and he did a more thorough job with this than I did, so definitely read his comment if you're going to read mine. I will add to this that that I somewhat combined the base 3 thinking with my first method, finding how many operations it took to reach all the numbers up to different powers of 3. I'm not sure, but I think extrapolating this is a decent method of estimating the final answer we want. The first few seem weird because they're still affected by the granularity of our operations, but after that a pattern seems to emerge of each new power of 3 taking usually 2, but sometimes 1 more operation. I'm not sure how to format this the best, but here's the results of that: 31 ->5, 32 ->6, 33 ->6, 34 ->7, 35 ->9, 36 ->11, 37 ->13, 38 ->15, 39 ->17, 310 ->18, 311 ->20, and the largest one I checked 316 ->29. Since all phone numbers are less than 321, if this pattern continues, it will take something like 38 operations to be able to reach all phone numbers. But this is a rough estimate and could easily be missing something, and it feels too wishy-washy, hand-wavey to me.
So my final approach (so far) was to combine my original brute-force approach with the solve-backwards method that u/CheesedWisdom talked about (further down in this thread). instead of starting at 0 and working up, we start at a phone number we want and work in reverse. In an attempt to maximize our downward decent without actually exploring every option, we simply divide by 3 if we can and subtract 7 otherwise. This will overestimate the number of operations for certain numbers, especially ones of the form 7*3n - 2, but it will give us a definitive way to get to every phone number. To try to mitigate the overestimation, I started by doing the bottom-up method for phone numbers up to 316 (basically when my computer had trouble continuing) and then for all the other numbers did the downward method until I reached a number that I had performed the bottom-up method for.
Awkwardly, I'm still running this version now as I type this, but the people who asked for reminders will be showing up soon. It's over a third of the way done, and the largest number of operations it has found so far is 42 for the number (349)-343-0687. I'll be surprised if it gets higher than 44, but I'll update whenever it decides to finish (hopefully when I get home tonight). It finally finished running, and the largest number of operations it found was 44 for the number (677)-662-0697. This is an upper bound for the actual number of operations it takes, so it seems like my earlier prediction of 38 operations might actually be close to the correct answer. This really surprises me since I originally thought the first comment's estimate was way too low, but they were pretty close to my answer.
If I decide to try another attempt, I would take any number that takes over 38 operations and try a branching path to solve that number more thoroughly, basically trying to check if it actually requires that many or if it's something that could be made easier with some +2's. But fuck if this isn't a delightfully weird problem.
So this is a pretty complex problem. The easiest way is to start from your phone number then run operations in reverse (-7, +2, /3) to get to 0.
It boils down to looking at the modulus base 3 of the number at each step. Subtracting 7 and adding 2 both reduce the modulus by 1. Every time the modulus is 0, it only takes one step to reduce the number. Every time the modulus is 1, it takes 2 steps to reduce the number. Every time the modulus is 2, it takes 3 steps to reduce the number.
For example 30 is modulus 0, so you can get down to 10 in one step (30/3 = 10) 31 is modulus 1, so you can get down to either 11 or 8 in two steps (31+2 = 33, 33/3 =11; 31-7 = 24, 24/3 = 8).
Now when the modulus is 2, you can either add 2 twice, subtract 7 once, or add 2 and subtract 7. The tricky part is figuring out which you want to do to set up the next step better.
Each of the resulting numbers is divisible by 3, but 9 is divisible by 3 twice, which means you get to divide the number by 27 with 5 steps, while the others would require extra steps.
So to solve this, you'd essentially have to guess and check at each step, making a giant decision tree and figuring out which is the shortest path to 0.
My number took 44 clicks but the 4th number from the bottom was 7, so that would only be 41 clicks (and using the 7 could probably bring it down a bit more if you think ahead to the next number and plan for it to be more easily divisible by 3
Hi OP, do you have source code or a demo you'd like to share? If so, reply to this comment so everyone can see (Github and similar services are permitted)
A simple (not optimal) algorithm to solve this problem would be to start with the target number, then add 0 to 2 "+2" to make the number divisible by 3, then repeat that until you get something that can be reduced to 0 faster with "-7" and "+2" than dividing by 3. Then run the inverse of all those operations, the presented input method, in reverse order to obtain your phone number.
Oh this is easy. Look at your phone number, start reducing it as much as possible by some number. You should reduce as much so that you can get to that reduced number by simply adding or multiplying a few times. Then once at that number, start multiplying by what you reduced it with until you reach your number. ez pz lemon squezzy.
500
u/PM_ME_IN_A_WEEK Dec 04 '19
As long as you don't use / 5 it shouldn't be too hard
118
u/[deleted] Dec 04 '19
I think you should be able to get to every phone number in at most 35 clicks, using only +7,-2,×3
It's probably less than 35 but it's more than 25, I'm pretty sure
4
u/thblckjkr Dec 05 '19
Where is the source/demo OP? I want to play it
1.0k
u/dead-inside69 Dec 04 '19
I loved the panicked cursor wiggle
557
u/Serpent9000 Dec 04 '19
If you scroll down far enough you find extra advanced mode.
199
u/elan17x Dec 04 '19
Now i want to create a ui based on the inverted collatz conjecture
82
u/Sligee Dec 04 '19
Mod your number by 7, then get to that number by other means, then add 7 till you get your number
35
u/ounilith Dec 04 '19
"Aye gurl, give me your digits"
"00-Infinity"
"That's hot"
23
u/[deleted] Dec 04 '19
The way the mouse cursor is just spazzing out has me dying
21
u/per_mission Dec 04 '19
Officially certified as a NOT TREATMENT to an anxiety
17
u/matt1155 Dec 04 '19
That -2 is really a helper when you got 9 digits !
•
u/AutoModerator Dec 04 '19
Hi OP, do you have source code or a demo you'd like to share? If so, reply to this comment so everyone can see (Github and similar services are permitted)
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
8
u/[deleted] Dec 04 '19
Can you make it so each pixel of mouse movement increases the number by 1?
48
u/supremedalek925 Dec 04 '19
Is there a subreddit for intentionally bad UI like this?
13
u/T351A Dec 04 '19
NaN? NANI?!
JavaScript 'nam flashbacks (NaN flashbacks?)
6
u/Lekebil Dec 05 '19
A simple (not optimal) algorithm to solve this problem would be to start with the target number, then add 0 to 2 "+2" to make the number divisible by 3, then repeat that until you get something that can be reduced to 0 faster with "-7" and "+2" than dividing by 3. Then run the inverse of all those operations, the presented input method, in reverse order to obtain your phone number.
4
u/AL_O0 Dec 04 '19
That’s wonderful
4
u/jroddie4 Dec 05 '19
Entering my phone number any% glitchless
1
u/steve-0-tron Dec 05 '19
no link?
1
u/HeirToGallifrey Dec 05 '19
How has no one mentioned that the x2 and then the √ don’t cancel each other out but instead somehow give a completely different number?
3
u/[deleted] Dec 05 '19
How could this problem be expressed?
If I wanted to find a number (850)555-6765 using only the first group of inputs, could I express that as a formula?
3
u/[deleted] Dec 05 '19
I found my phone number using this for a fun little challenge.
My solution, in practice, would require hitting the +7 button over 470,950,000 times to find my number.
Guys, I'm not sure this is a very practical way to get users to input their phone numbers.
2
u/MrTimmannen Dec 05 '19
ah, finally an efficient way of dialing my nan
2
u/Childish_Brandino Dec 05 '19
Should be pretty easy to do just by using the +7,-2, and X3 functions. It will just take a long time
2
u/petezhut Dec 05 '19
What in the darkest of the nine hells is "advanced mode"?
2
u/[deleted] Dec 05 '19
am i supposed to jack off to posts from this sub?
2
u/ramdonuser Dec 05 '19
This ui is more than fine, is perfect. The only issue I see is the lack of a reset button
2
u/SpaghettiSauceXD Dec 05 '19
Yeah nothing can ascend this
2
u/[deleted] Dec 08 '19
New subber here... I choked myself laughing at this.
2
u/The_Lamb_Sauce2 Dec 25 '23
Man this a fun game
1
u/quaductas Dec 04 '19
I would love to try this out! Is there a demo at all? RemindMe! 3 days
1
u/BrogPOGO Dec 05 '19
Is there a link for this..... I kinda want to try it now
1
u/AmsterdamNYC Dec 05 '19
Laughed so hard at this dumb shit
1
u/mrthirsty Dec 05 '19
Reminds me of this
1
u/DeltaHex106 Dec 05 '19
Oh this is easy. Look at your phone number, start reducing it as much as possible by some number. You should reduce as much so that you can get to that reduced number by simply adding or multiplying a few times. Then once at that number, start multiplying by what you reduced it with until you reach your number. ez pz lemon squezzy.
1
u/Sinaneos Dec 05 '19
When he clicked "advanced mode" I burst out laughing
1
u/ayyyee9 Dec 05 '19
It came to a number starting with 650, thats my area code!
1
u/snipy67 Dec 05 '19
I can’t wait to see one of these in the wild
If(DateTime.Today.Month == 4&&DateTime.Today.Day == 1) //display this ui
1
u/North_Wynd33 Dec 13 '19
lmaooo nice
1
u/Subterrainio Feb 20 '20
u/sligee knows how to operate this
1
u/pietro140616reddit Sep 06 '26
u/savevideo
0
u/Bastian_5123 Dec 06 '19
Floor of -.01 or so would be -1. Round down, 0>-1