Did any of you ever read "The Code Book" by Simon Singh? He did what Sepero's just done, and had 10 levels of difficulty. If I remember rightly, there was a cash prize, but that was several years ago. Great read.
Originally posted by o0zi Did any of you ever read "The Code Book" by Simon Singh? He did what Sepero's just done, and had 10 levels of difficulty. If I remember rightly, there was a cash prize, but that was several years ago. Great read.
I'm actually in the process of reading that. Singh writes some damn good math books. I also read his Fermat's Theorem book(can't remember exactly what it was)...maybe Fermat's Enigma, or was that by someone else, ramble, ramble...
if (i_forgot && this_is_about_code)
language = c++;
Here's another challenge:
rand( ) in C generates a flat distribution of numbers; you are equally likely to get any given number the generator is capable of returning. If you histogram these numbers the histogram is relatively flat. Looking at the histogram ( sideways ) it might look like this:
x =0
xxxxxxxxxxx
xxxxxxxxxx
xxxxxxxxxxxx
xxxxxxxxxx
xxxxxxxxxxx
xxxxxxxxxxxx
xxxxxxxxxxxx
xxxxxxxxxxx
xxxxxxxxxxxx
xxxxxxxxxxx
xxxxxxxxxx
xxxxxxxxxxx
x = 2^32 - 1
Write a function such that the numbers are distributed as x^2. In other words if you histogrammed many numbers from your function it would look like this ( sideways ):
x = -1
xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxx
xxxxxxxxxx
xxxxx
xx
x
xx
xxxx
xxxxxxxxxx
xxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
x = 1
only produce numbers on the interval [-1,1] instead of [0,2^32-1]. Put your function in a small program that outputs to the console a 20 bin ( line ) histogram similar to the one's I've shown above to prove ( by eyeball method ) that your function works correctly. If you really want to show off the function's legitimacy compute the chi-squared. You are allowed to use your language's native flat-distribution random number generator in your program.
Originally posted by trashthing i have a challenge. write a program that reads a text file and prints out how many characters, numbers, letters, words, and lines there are.
Originally posted by o0zi Convert decimal numbers to a base up to base 36, where numbers after 0-9 are represented by A-Z.
Cool. I only thought I had to do 36base, but after re-reading it, I see he wanted "up to base 36". After a few modifications, it does binary, octal, hex, up to base36 and everything inbetween!!!
Challenge: Write a function that reverses the bits of an integer, i.e. 100110 -> 011001. The shorter the function the better. This is an essential procedure when coding a fast fourier transform.
unsigned int reverseBits(unsigned int x) {
unsigned int res(0), cntr(0xFFFFFFFF);
while (cntr) {
cntr >>= 1;
res <<= 1;
res |= x & 1;
x >>= 1;
}
return res;
}
if (i_forgot && this_is_about_code)
language = c++;