generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Does anyone understand this voodoo magic?

Previous Thread :: Next Thread 
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
28 Jul 2014 09:30 PM
While scripting one day not too long ago from today, I stumbled across something unique and magical. Although this thread isn't necessarily about scripting, I can't really think of a better place where people might know the answer to this elsewhere and I got 0 replies on other non-roblox forums.

Anyways, I noticed that when I got the remainder of a number less than 65536, I got a value that is all the nibbles in that number added up.

For example:
51 % 15 = 6 (11 0011 % 1111 = 110)

Look carefully at the number represented in base 2, when you add up each nibble (in this case, 0011 + 0011) you get what would of been that number mod 15.
Report Abuse
Notunknown99 is not online. Notunknown99
Joined: 05 Sep 2008
Total Posts: 25360
28 Jul 2014 09:31 PM
Scripters, maybe?
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
28 Jul 2014 09:31 PM
That forum is all spam, I would just get troll replies if I went there.
Report Abuse
VisualGraphics is not online. VisualGraphics
Joined: 26 Nov 2010
Total Posts: 6515
28 Jul 2014 09:32 PM
give this guy a medal
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
28 Jul 2014 09:32 PM
Now that I think about it, I doubt the number matters.
I'm pretty sure it can be >= 65536
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
28 Jul 2014 09:47 PM
bump
Report Abuse
ehern11 is not online. ehern11
Joined: 23 Apr 2011
Total Posts: 1541
28 Jul 2014 09:54 PM
how do you open the developer panel :>
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
29 Jul 2014 11:43 AM
bump
Report Abuse
maxomega3 is not online. maxomega3
Joined: 11 Jun 2010
Total Posts: 10668
29 Jul 2014 11:44 AM
When cntkillme has a problem, SH cries.

I have no idea what you're talking about, man
Report Abuse
Accomplishable is not online. Accomplishable
Joined: 13 Aug 2009
Total Posts: 6207
29 Jul 2014 11:45 AM
XD
Report Abuse
Notunknown99 is not online. Notunknown99
Joined: 05 Sep 2008
Total Posts: 25360
29 Jul 2014 11:46 AM
Really this should be in Scripters, you are more likely to find someone who knows there.
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
29 Jul 2014 11:54 AM
But notun, people like CoolioTree hang out there D:
Have you seen this, too:
http://www.roblox.com/Forum/ShowPost.aspx?PostID=141791446
Report Abuse
maxomega3 is not online. maxomega3
Joined: 11 Jun 2010
Total Posts: 10668
29 Jul 2014 12:00 PM
cnt,
ruined my day
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
29 Jul 2014 12:01 PM
Yeah, what happens in Scripters... I can't go there and expect any answer worth reading
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
30 Jul 2014 01:25 PM
bump
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
02 Aug 2014 05:18 PM
bump
Report Abuse
rowerowe71 is not online. rowerowe71
Joined: 14 Apr 2013
Total Posts: 1999
02 Aug 2014 05:32 PM
cntkill

you're the best guy here mate but I'm pretty sure you're one of the smartest

so no one knows what you're talking bout

sorry
Report Abuse
nicemike40 is not online. nicemike40
Joined: 19 Dec 2008
Total Posts: 1814
02 Aug 2014 05:35 PM
It works in decimal and hexadecimal also:

51 mod 9 = 5 + 1 = 6

#33 mod #F = 3 + 3 mod #F = 6

And, I would guess, any other base
Report Abuse
nicemike40 is not online. nicemike40
Joined: 19 Dec 2008
Total Posts: 1814
02 Aug 2014 05:38 PM
It's called 'casting out nines' in dec
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
02 Aug 2014 06:05 PM
Yeah I know that but like, how/why does it work?
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
02 Aug 2014 06:10 PM
I don't think it works in all bases for the most part.
In hexadecimal for sure but if I do

10 % 15 I get 10, but 1 + 0 = 1

In hex it works out perfectly:
A % F = A
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
02 Aug 2014 06:11 PM
Wait, ignore my last post it does work in all cases.
I'll see if there is a wikipedia entry about it
Report Abuse
nicemike40 is not online. nicemike40
Joined: 19 Dec 2008
Total Posts: 1814
02 Aug 2014 06:13 PM
So if you have a number, let's say 515, it can be represented by

5*100 + 1*10 + 5

==

5*(99+1) + 1*(9+1) + 5

== (5*99 + 1*9) + 5 + 1 + 5

However, the (5*99 + 1*9) is a multiple of 9, so when you take the modulus it doesn't affect the remainder, so you get

515 mod 9 == (5*99 + 1*9) + 5 + 1 + 5 mod 9 == 5 + 1 + 5 mod 9 == 11 mod 9

(and then repeat --> 1+1 mod 9 == 2)

The fact that it works by adding up it's nibbles is just because you're switching bases around
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
02 Aug 2014 06:17 PM
So basically:
number % (base - 1) = sumofeachpart % (base - 1)?
156 % 9 = 12 % 9
3 = 3

Woah that's actually neat. Thank you.
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
02 Aug 2014 06:18 PM
part being the digit of a number (or in any other base, the appropriate term).
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image