Author |
Topic: Notepad calculator (Read 614 times) |
|
Mike_V
Junior Member
Gender:
Posts: 60
|
|
Notepad calculator
« on: Oct 5th, 2003, 1:22pm » |
Quote Modify
|
This is a sorta weird one I guess. So you're working on your friend's computer, and he's really anal about keeping it "clean" and thus the only program he has on it is notepad. (Essentially, any basic text editor will do.) But your class is in 2 minutes and you need to find out whether or not the following number is divisible by 3. Can you find out using only notepad and less than 2 minutes? 523452125329407519578219589510156328572608576510156315083275608165715062 875612083576178056385618056310586215082376508217658235612856718056128137 582148324210983527865896548731567180657816587236875178664538906344214325 710953498571894573458732376728798438747365271828837561751562387573715062 158726158728371585643233456787543343556373982991877387576108751097873765 676484786367672198565698156956956942675676717667616152098735621589283965 689125689326598265619589726526354782852381984623815987236502985621498729 156237651928532895071059327598342759871095791208579182752930570195719050 101059235790105021050230025352321111111238592357329856938275698299578257 674777838298756125112345358911234567890123592980953082759198589347458932 6298058917509175901578120935333 (Note: that weird space at the end is irrelevent, I did not mean it to be there.) (Note 2: you don't have to figure out the method in 2 minutes, you just have to be able to complete the method in 2 minutes or so.)
|
« Last Edit: Oct 5th, 2003, 2:07pm by Icarus » |
IP Logged |
Don't specify the unspecified.
|
|
|
Sir Col
Uberpuzzler
impudens simia et macrologus profundus fabulae
Gender:
Posts: 1825
|
|
Re: Notepad colculator
« Reply #1 on: Oct 5th, 2003, 1:39pm » |
Quote Modify
|
It's probably not the best method, but it might work in about 2 minutes... :: Based on the property that a number is divisible by 3 iff the sum of its digits is divisble by 3, you could do the following: (i) work through the list of digits and remove multiples of 3 (0, 3, 6, and 9). (ii) replace the remaining digits with the remainder after division by 3; so 5[to]2, 7[to]1, and so on. (iii) count the number of 1's (a) and the number of 2's (b). (iv) if a+2b is divisible by 3, then the original number was. OR (iii) remove three 1's at a time, then remove three 2's at a time. (iv) if the sum of the remaining digits is divisible by 3, then the original number was. ::
|
|
IP Logged |
mathschallenge.net / projecteuler.net
|
|
|
towr
wu::riddles Moderator Uberpuzzler
Some people are average, some are just mean.
Gender:
Posts: 13730
|
|
Re: Notepad colculator
« Reply #2 on: Oct 5th, 2003, 2:02pm » |
Quote Modify
|
yep, that's basicly the easiest way I think. Just removes any number divisable by three, every set of three equal numbers, every sequence of three following numbers, basicly any set of numbers that sum to a multiple of three and which is easy enough to see note that using search can help a lot in speeding things up. something like replace even more (but that's not in notepad)
|
« Last Edit: Oct 5th, 2003, 2:04pm by towr » |
IP Logged |
Wikipedia, Google, Mathworld, Integer sequence DB
|
|
|
Icarus
wu::riddles Moderator Uberpuzzler
Boldly going where even angels fear to tread.
Gender:
Posts: 4863
|
|
Re: Notepad calculator
« Reply #3 on: Oct 5th, 2003, 2:11pm » |
Quote Modify
|
Replace is in Notepad. It's ctrl-h. I have cause to use it on a fairly regular basis. By the way, I tried this method. It took a lot longer than 2 minutes and I'm not too sure I didn't mess up in the middle anyway. (The result I got was that it [equiv] 2 mod 3.)
|
« Last Edit: Oct 5th, 2003, 2:24pm by Icarus » |
IP Logged |
"Pi goes on and on and on ... And e is just as cursed. I wonder: Which is larger When their digits are reversed? " - Anonymous
|
|
|
Sir Col
Uberpuzzler
impudens simia et macrologus profundus fabulae
Gender:
Posts: 1825
|
|
Re: Notepad calculator
« Reply #4 on: Oct 5th, 2003, 2:31pm » |
Quote Modify
|
What a super idea, Icarus! It took me 58 seconds, and I did it in the following way: (a) Replace ' ', with <empty>. (b) Replace '0', '3', '6', and '9', with <empty>. (c) Replace '4' and '7' with '1'. (d) Replace '5' and '8' with '2'. (e) Randomly replace '12', '21', '111', and '222' with <empty>. I was left with nothing, so it appears that the number divides by 3. I then checked by writing a programme to add the digits and they add to 3588=3*1196.
|
|
IP Logged |
mathschallenge.net / projecteuler.net
|
|
|
Icarus
wu::riddles Moderator Uberpuzzler
Boldly going where even angels fear to tread.
Gender:
Posts: 4863
|
|
Re: Notepad calculator
« Reply #5 on: Oct 5th, 2003, 2:38pm » |
Quote Modify
|
The idea was Towr's, and you clearly were wiser than I in implementing it. I did the replacements a-d, but then I stopped and just started deleting 2's counting off three at a time. When I finished, I divided the 1s into equal lines, deleting sets of three lines together. This is why it took me so long. Your method of handling the 1s and 2s is so obvious now that I am chagrined not to have seen it.
|
|
IP Logged |
"Pi goes on and on and on ... And e is just as cursed. I wonder: Which is larger When their digits are reversed? " - Anonymous
|
|
|
Rezyk
Guest
|
I think it's better to use '11' instead of '2'. Then for the last step all you need is '111' [to] ''.
|
|
IP Logged |
|
|
|
Mike_V
Junior Member
Gender:
Posts: 60
|
|
Re: Notepad calculator
« Reply #7 on: Oct 5th, 2003, 4:05pm » |
Quote Modify
|
on Oct 5th, 2003, 3:59pm, Rezyk wrote:I think it's better to use '11' instead of '2'. Then for the last step all you need is '111' [to] ''. |
| That's a great idea! One step back, then all the way forward.
|
« Last Edit: Oct 5th, 2003, 6:18pm by Mike_V » |
IP Logged |
Don't specify the unspecified.
|
|
|
Sir Col
Uberpuzzler
impudens simia et macrologus profundus fabulae
Gender:
Posts: 1825
|
|
Re: Notepad calculator
« Reply #8 on: Oct 5th, 2003, 5:13pm » |
Quote Modify
|
on Oct 5th, 2003, 2:38pm, Icarus wrote: Oops, I didn't see his hidden part; sorry, towr. What an inspired thought, Rezyk! By the way, that was a super puzzle, Mike_V.
|
|
IP Logged |
mathschallenge.net / projecteuler.net
|
|
|
Mike_V
Junior Member
Gender:
Posts: 60
|
|
Re: Notepad calculator
« Reply #9 on: Oct 5th, 2003, 6:14pm » |
Quote Modify
|
Thanks, it was inspired while I was working on your expansion of T&B's n! problem. (Before I remembered the clue.) And actually, thanks to Rezyk's idea, this method also is very viable for divisibilty by 9.
|
|
IP Logged |
Don't specify the unspecified.
|
|
|
towr
wu::riddles Moderator Uberpuzzler
Some people are average, some are just mean.
Gender:
Posts: 13730
|
|
Re: Notepad calculator
« Reply #10 on: Oct 5th, 2003, 11:31pm » |
Quote Modify
|
on Oct 5th, 2003, 2:11pm, Icarus wrote:Replace is in Notepad. It's ctrl-h. I have cause to use it on a fairly regular basis. |
| It's not in my notepad
|
|
IP Logged |
Wikipedia, Google, Mathworld, Integer sequence DB
|
|
|
towr
wu::riddles Moderator Uberpuzzler
Some people are average, some are just mean.
Gender:
Posts: 13730
|
|
Re: Notepad calculator
« Reply #11 on: Oct 5th, 2003, 11:34pm » |
Quote Modify
|
on Oct 5th, 2003, 3:59pm, Rezyk wrote:I think it's better to use '11' instead of '2'. Then for the last step all you need is '111' [to] ''. |
| If you just replace every number be 1's (so replace fi 5 by 5 1's), then you can check any divisability. it's divisable by n if you're not left with anything after replacing all sequences of n 1's by nothing..
|
|
IP Logged |
Wikipedia, Google, Mathworld, Integer sequence DB
|
|
|
Rezyk
Junior Member
Gender:
Posts: 85
|
|
Re: Notepad calculator
« Reply #12 on: Oct 6th, 2003, 12:25am » |
Quote Modify
|
on Oct 5th, 2003, 11:34pm, towr wrote: If you just replace every number be 1's (so replace fi 5 by 5 1's), then you can check any divisability. it's divisable by n if you're not left with anything after replacing all sequences of n 1's by nothing.. |
| I think that only works for n [in] {1, 3, 9}. Questions such as "Is 32 divisible by 2?" and "Is 33 divisible by 2?" would get answered incorrectly.
|
|
IP Logged |
|
|
|
towr
wu::riddles Moderator Uberpuzzler
Some people are average, some are just mean.
Gender:
Posts: 13730
|
|
Re: Notepad calculator
« Reply #13 on: Oct 6th, 2003, 1:12am » |
Quote Modify
|
hmm.. yes, you're right.. I didn't think straight for a moment.. (it happens.. (quite a lot))
|
|
IP Logged |
Wikipedia, Google, Mathworld, Integer sequence DB
|
|
|
Sir Col
Uberpuzzler
impudens simia et macrologus profundus fabulae
Gender:
Posts: 1825
|
|
Re: Notepad calculator
« Reply #14 on: Oct 6th, 2003, 3:22am » |
Quote Modify
|
I know that feeling all too well, towr. I must say that I read your original suggestion and was all ready to click 'Reply' to congratulate your insight, then Rezyk, in his/her 2nd post, makes another sharp observation. By the way, welcome to the forum, Rezyk.
|
|
IP Logged |
mathschallenge.net / projecteuler.net
|
|
|
Mike_V
Junior Member
Gender:
Posts: 60
|
|
Re: Notepad calculator
« Reply #15 on: Oct 6th, 2003, 4:21am » |
Quote Modify
|
Haha, yep. I too jumped on that idea for a sec. The question is then, is there a way to check for multiple divisibilities without actually dividing the number? ie can we use some version of this method to check for divisibility by 27? (Since 27 doesn't have the property that (the sum of the digits of 27k) [equiv] 0 (mod 27). But perhaps there's a way to check for divisibility by 9 and then by 3, excluding that factor of 9 . . .) And towr. Sorry, I should have specified: notepad version 5.1
|
|
IP Logged |
Don't specify the unspecified.
|
|
|
towr
wu::riddles Moderator Uberpuzzler
Some people are average, some are just mean.
Gender:
Posts: 13730
|
|
Re: Notepad calculator
« Reply #16 on: Oct 6th, 2003, 5:12am » |
Quote Modify
|
Well, it's easy enough to check if it's divisable by 2,4 and several other powers of 2, or several powers of 5, or any power of ten. But powers of three will take a bit more thinking..
|
|
IP Logged |
Wikipedia, Google, Mathworld, Integer sequence DB
|
|
|
James Fingas
Uberpuzzler
Gender:
Posts: 949
|
|
Re: Notepad calculator
« Reply #18 on: Oct 6th, 2003, 10:28am » |
Quote Modify
|
on Oct 6th, 2003, 4:21am, Mike_V wrote:The question is then, is there a way to check for multiple divisibilities without actually dividing the number? ie can we use some version of this method to check for divisibility by 27? |
| The general divisibility tests involve multiplying each digit by a coefficient and then adding them. It would be possible in notepad, but not just using search/replace.
|
|
IP Logged |
Doc, I'm addicted to advice! What should I do?
|
|
|
BNC
Uberpuzzler
Gender:
Posts: 1732
|
|
Re: Notepad calculator
« Reply #19 on: Oct 6th, 2003, 3:26pm » |
Quote Modify
|
on Oct 6th, 2003, 4:21am, Mike_V wrote: ie can we use some version of this method to check for divisibility by 27? |
| For your example of 27, the best divisibility rule I know is (using 27*37=999) to divide the number into groups of 3 (strating from the right), and adding the groups together. The number is divisible by either 27 or 37 iff the result does. (The process may have to be repeated).
|
|
IP Logged |
How about supercalifragilisticexpialidociouspuzzler [Towr, 2007]
|
|
|
NickH
Senior Riddler
Gender:
Posts: 341
|
|
Re: Notepad calculator
« Reply #20 on: Oct 14th, 2003, 12:52pm » |
Quote Modify
|
Here's a related puzzle. With the same rules as the original puzzle, show the following number is composite: 11871419003987228264918498796376974960729607480040 68449946337915761479776150552447513118714190039872 28264918498796376974960729607480040684499463379157 61479776150552447513118714190039872282649184987963 76974960729607480040684499463379157614797761505524 47513118714190039872282649184987963769749607296074 80040684499463379157614797761505524475131187141900 39872282649184987963769749607296074800406844994633 79157614797761505524475131187141900398722826491849 87963769749607296074800406844994633791576147977615 05524475131187141900398722826491849879637697496072 96074800406844994633791576147977615055244751311871 41900398722826491849879637697496072960748004068449 94633791576147977615055244751311871419003987228264 91849879637697496072960748004068449946337915761479 77615055244751311871419003987228264918498796376974 96072960748004068449946337915761479776150552447513
|
|
IP Logged |
Nick's Mathematical Puzzles
|
|
|
Rezyk
Junior Member
Gender:
Posts: 85
|
|
Re: Notepad calculator
« Reply #21 on: Oct 14th, 2003, 11:30pm » |
Quote Modify
|
Also, how do you use notepad to determine the value of (x mod 11) for any x (that can fit in notepad) in a constant number of steps? Note: I take advantage of a quirk of notepad that I can't be sure exists in all versions. (I'm using Version 5.0 Build 2195 SP4) Hint: The quirk involves File->Save. My method should also be extendable to any number instead of 11, actually. on Oct 6th, 2003, 3:22am, Sir Col wrote:By the way, welcome to the forum, Rezyk. |
| Thanks! I've been a lurker/fan for a while.
|
|
IP Logged |
|
|
|
|