|
It was renamed... In 2620. Don't you watch Futurama?
|
|
|
|
|
I haven't watched Futurama, because I boycotted The Simpsons in Season 2 and haven't watched anything by Matt Groening since. I know. Pretty cool, huh?
|
|
|
|
|
This whole chain of riffs was great though. Way to go out there.
|
|
|
|
|
You know, as someone who's been messing around in Project Euler lately and could now code a Sieve of Eratosthenes* in his sleep, that algorithm makes me cry a little inside.
(You know, it's easier to code the algorithm than to spell that guy's name...)
|
|
|
|
|
All odd numbers are prime, right? Let me check. Yep, all odd numbers are prime.
Makes it a lot easier to count by the primes.
Also, are there more odd numbers or even numbers? I know the answer, but it's a puzzle for you.
|
|
|
|
|
newton.saber wrote: Also, are there more odd numbers or even numbers? I know the answer, but it's a puzzle for you.
I dunno, let's find out... You start naming odd numbers, and I'll start naming even numbers... Whoever can name more of them wins!
By the way, is Infinity odd or even? I mean, it's a sideways 8, and 8 is even... But since it's sideways, that's a little odd, right? It's also kind of a car, except they spell it oddly, so maybe the original spelling is even... My head hurts...
|
|
|
|
|
Quote: By the way, is Infinity odd or even? I mean, it's a sideways 8, and 8 is even... But since it's sideways, that's a little odd, right?
Please, stop! You're hurting me!
|
|
|
|
|
newton.saber wrote: it's a puzzle for you.
Not really: there are an infinite quantity of each.
The way we define "more", "less", and "equal" for infinite quantities is as follows. For two collections A and B (say A are the even numbers and B are the odd numbers) we say that
If you can associate every item in A with a unique item in B, and vice versa, then A and B are the same size.
If you can associate every item in A with a unique item in B, but not vice versa, then B is bigger than A.
If you can associate every item in B with a unique item in A, but not vice versa, then A is bigger than B.
In this case you can associate every even number n with the odd number n+1, and you can associate every odd number m with the even number m−1 (assuming 0 is even) so therefore there are just as many odd numbers as even numbers.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
This is terribly incorrect, because I stopped counting on an odd number, so there are more odd numbers than even. Thank you for your input.
|
|
|
|
|
You might get a more accurate result if you start at infinity and count backward.
modified 27-Oct-14 15:19pm.
|
|
|
|
|
PIEBALDconsult wrote: You might get a more accurate result if you start at infinity and count backward
Great idea. I'm working on this now.
|
|
|
|
|
Chuck Norris already did it.
Twice.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
+2 for the chuck norris reference. I should've seen it coming, but I was busy with my countdown from infinity.
|
|
|
|
|
newton.saber wrote: All odd numbers are prime, right?
No, primes aren't just any odd number.
|
|
|
|
|
PIEBALDconsult wrote: No, primes aren't just any odd number.
Of course they are. It's ridiculous to think that they aren't.
|
|
|
|
|
At least he used the % operator rather than implementing his own function.
|
|
|
|
|
I suspect luck was involved.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Yeah, it could have been worse...
public static bool SeeIfNumberIsOdd(int i)
{
for (int n = i; n > 0; n--)
{
if (n==1)
return true;
else if (n==2)
return false;
}
return true;
}
That felt dirty to write... Ok, I probably could have made it a LITTLE worse... Maybe O(n^2), but that might be gratuitous.
|
|
|
|
|
|
Bah, I can do better than that!
public function SuperMod(int n, int o)
{
int p = o;
loopy:
while (p < n) p += o;
if (p < n) goto loopy;
int answer = p - n;
return answer;
}
Ok, I think that's about as bad as I can make it, and though I didn't test it at all (Honestly, I think the compiler would come to life and slit my throat for even trying to execute this monstrosity), that should technically give the right answer... Unless 'o' is negative or zero, but validating parameters is so 20th century...
|
|
|
|
|
Ian Shlasko wrote: give the right an answer
FTFY
|
|
|
|
|
Heh, yeah, you're right... It needs to be n+o-p... But hey, what's the point of testing when you're trying to write the worst code possible?
(Still haven't tested... I was going to, but the compiler pulled a knife on me and said some very non-KSS things would happen if I tried)
|
|
|
|
|
Cut and pasted !
|
|
|
|
|
Ok, but if you're gonna use that code, make sure to either fix the bug, or... uh... only test with (4,2).
|
|
|
|
|
Testing ? If it fails, that's what Q&A is for. I don't need to test.
|
|
|
|