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.
Printable View
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...Quote:
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.
You have no idea how much pain this problem gave me. :DQuote:
Originally posted by grady
Compute the complex product ( a + ib ) * ( c + id ) using only three real multiplications
x = (a+b)(c+d)
y = ac
z = bd
Answer = y-z + (x-y-z)i
(claps Strogian) Ingenious, absolutely ingenious...:)
Hey strogian g/j, you got all my challenges. :)
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.
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.
Quote:
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.
You just have to give it the right options... ;)Code:#!/bin/bash
/usr/bin/wc "$@"
Another challenge: write a program that converts any decimal number to any 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!!! :DQuote:
Originally posted by o0zi
Convert decimal numbers to a base up to base 36, where numbers after 0-9 are represented by A-Z.
I'm attaching the binary for any non-C++ programmers. I might actually use this program sometime, so I thought you guys might too. :)
Cool solution. You put it under the LGPL? There's a man with principles:p
Thanks for the compliment.(Notice my signature) :D
I was gonna use GPL, but I figured it's a little extreme for something small as this.
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.
do you mean like this:
orCode:unsigned int x(1000);
return ~x;
Code: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;
}
The latter, I didn't realize my example was an xor too.