1 kyu

Mystery function #2

Description:

Finished Mystery function #1( http://www.codewars.com/kata/mystery-function-number-1 )?

Here's a new (read REALLY HARD) challenge for you. There's a mysterious hash function which is already available for you to use. It's a function called mystery that accepts an integer as a parameter and outputs a integer. The exercise depends on guessing what this function actually creates its hash.

You can call the mystery function like this:

   var myOutput = mystery(123);

Using your own test cases, try to call the mystery function with different input numbers and try to analyze its output in order to guess what is does. You are free to call the mystery function ONLY ONCE.

When you think you've understood how my mystery function works, prove it by reimplementing its logic in a function that you should call 'solved(x)'. To validate your code, your function 'solved' should return the same output as my function 'mystery' given the same inputs.

Beware! Passing your own test cases doesn't imply you'll pass mine. Learn about hash functions here:http://en.wikipedia.org/wiki/Hash_function

Cheaters are welcome :) Using statistics on bits is a good way of solving this.

Good luck and Have fun!

Algorithms
Puzzles
Security
Games
Mathematics
Bits

More By Author:

Check out these other kata created by tianshuo

Stats:

CreatedMar 14, 2015
PublishedMar 14, 2015
Warriors Trained4481
Total Skips307
Total Code Submissions14219
Total Times Completed192
JavaScript Completions192
Total Stars162
% of votes with a positive feedback rating86% of 57
Total "Very Satisfied" Votes44
Total "Somewhat Satisfied" Votes10
Total "Not Satisfied" Votes3
Total Rank Assessments5
Average Assessed Rank
1 kyu
Highest Assessed Rank
1 kyu
Lowest Assessed Rank
1 kyu
Ad
Contributors
  • tianshuo Avatar
  • __TomFoolery__ Avatar
  • Voile Avatar
  • fsafsffs Avatar
Ad