flat assembler
Message board for the users of flat assembler.

 Index > Heap > Numerical oddities Goto page Previous  1, 2, 3 ... 19, 20, 21 ... 24, 25, 26  Next
Author
MHajduk

Joined: 30 Mar 2006
Posts: 6034
Location: Poland
MHajduk
revolution wrote:
MHajduk wrote:
Our symbol n may be any positive integer number.
Right, so it is arbitrary. So I suggest that this cannot produce a specific result.
It can, it's how math works. The given scheme can produce infinite number of correct answers for the arbitrary taken n.
13 May 2012, 12:28
revolution
When all else fails, read the source

Joined: 24 Aug 2004
Posts: 17270
revolution
Can you give me an example of this working in practice? How can I test this at home?
13 May 2012, 12:32
MHajduk

Joined: 30 Mar 2006
Posts: 6034
Location: Poland
MHajduk
revolution wrote:
How can I test this at home?
You can test it not only at home but also in the street, in the train or park. It only needs a sheet of paper and pencil / pen.

Let the X be equal to 0. And let the n be equal to 256 (programmers like this number ).

We know that X is congruent to 256 modulo 256

X ≡ 256 (mod 256)

i.e. gives the same rest as 0 when you divide it by 256.

We have a trivial congruence

3 ≡ 3 (mod 256)

(this number may be also any other between 1 and 255).

Because we can subtract congruences one from another, so

X - 3 ≡ 256 - 3 (mod 256)

so X - 3 gives the same rest as 253 modulo 256.

And consequently, after subtraction we have the greater rest than it was initially, because 253 > 0 = X.
13 May 2012, 12:44
revolution
When all else fails, read the source

Joined: 24 Aug 2004
Posts: 17270
revolution
I know how modulo works, but I can't get how this works if thing X is, say, a chair? What does the thief steal in that situation?
13 May 2012, 12:48
MHajduk

Joined: 30 Mar 2006
Posts: 6034
Location: Poland
MHajduk
revolution wrote:
I know how modulo works, but I can't get how this works if thing X is, say, a chair? What does the thief steal in that situation?
The given example tells us what goes with the number of chairs not with chairs themselves.
13 May 2012, 12:53
revolution
When all else fails, read the source

Joined: 24 Aug 2004
Posts: 17270
revolution
MHajduk wrote:
The given example tells us what goes with the number of chairs not with chairs themselves.
I understand. But you didn't say what the thief steals. How does this fit with the puzzle?
13 May 2012, 12:56
MHajduk

Joined: 30 Mar 2006
Posts: 6034
Location: Poland
MHajduk
We have to imagine such a strange thief who always "steals modulo n", so if there would be a negative number of chairs after the theft, he / she should bring so many chairs that fit the proper rest modulo n.

Yeah, a modular thief, that's good.
13 May 2012, 13:02
revolution
When all else fails, read the source

Joined: 24 Aug 2004
Posts: 17270
revolution
MHajduk wrote:
We have to imagine such a strange thief who always "steals modulo n", so if there would be a negative number of chairs after the theft, he / she should bring so many chairs that fit the proper rest modulo n.

Yeah, a modular thief, that's good.
Hehe, I like that answer. Very funny.

Okay, so moving on. Anyone else would like have a try? Or would MHajduk like to have another try?
13 May 2012, 13:06
MHajduk

Joined: 30 Mar 2006
Posts: 6034
Location: Poland
MHajduk

There is a well known fact that coins with the low nominal are less worth than a material (alloy) they are made of. So four one-cent coins may be more worth as a material than one five-cent coin.

Assume that the thief steals 4 cents, leaves 5 cents. You have more money, the thief has more money too if he is interested in the material the coins are made of.

13 May 2012, 13:16
revolution
When all else fails, read the source

Joined: 24 Aug 2004
Posts: 17270
revolution
Remember that thing X can be anything, not just money.
13 May 2012, 13:19
malpolud

Joined: 18 Jul 2011
Posts: 344
Location: Broken hippocampus
malpolud
You had 9 and now you have 010.
02 Jun 2012, 14:25
revolution
When all else fails, read the source

Joined: 24 Aug 2004
Posts: 17270
revolution
malpolud wrote:
You had 9 and now you have 010.
What is the thief stealing here?
02 Jun 2012, 14:27
malpolud

Joined: 18 Jul 2011
Posts: 344
Location: Broken hippocampus
malpolud
Anything: money, moles of water, chairs

E: he is stealing one quantity.
02 Jun 2012, 14:28
revolution
When all else fails, read the source

Joined: 24 Aug 2004
Posts: 17270
revolution
malpolud wrote:
Anything: money, moles of water, chairs
Okay, so how many chairs does the thief steal in your example?
02 Jun 2012, 14:30
malpolud

Joined: 18 Jul 2011
Posts: 344
Location: Broken hippocampus
malpolud
As mentioned in the edit: one chair.
02 Jun 2012, 14:31
revolution
When all else fails, read the source

Joined: 24 Aug 2004
Posts: 17270
revolution
But 9-1=8
02 Jun 2012, 14:35
malpolud

Joined: 18 Jul 2011
Posts: 344
Location: Broken hippocampus
malpolud
Exactly. 8 in octal numeral system
02 Jun 2012, 14:38
revolution
When all else fails, read the source

Joined: 24 Aug 2004
Posts: 17270
revolution
But 010 (oct) < 9 (dec). Fails to meet point three: "3. Now I have more of thing X than I had before the thief came along."
02 Jun 2012, 14:42
malpolud

Joined: 18 Jul 2011
Posts: 344
Location: Broken hippocampus
malpolud
Right but it does meet point 0: "This one is for fun also, don't take it too seriously"
02 Jun 2012, 14:45
revolution
When all else fails, read the source

Joined: 24 Aug 2004
Posts: 17270
revolution
malpolud wrote:
Right but it does meet point 0: "This one is for fun also, don't take it too seriously"
Agreed.
02 Jun 2012, 14:45
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First

 Jump to: Select a forum Official----------------AssemblyPeripheria General----------------MainDOSWindowsLinuxUnixMenuetOS Specific----------------MacroinstructionsCompiler InternalsIDE DevelopmentOS ConstructionNon-x86 architecturesHigh Level LanguagesProgramming Language DesignProjects and IdeasExamples and Tutorials Other----------------FeedbackHeapTest Area
Goto page Previous  1, 2, 3 ... 19, 20, 21 ... 24, 25, 26  Next

Forum Rules:
 You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot vote in polls in this forumYou can attach files in this forumYou can download files in this forum