• Ask Rouik.
    42 replies, posted
Why didn't you answer Empty_Shadow's questions?
[QUOTE=Empty_Shadow;29168467]Why didn't you answer my question?[/QUOTE] OP probably don't understand :downs:
[QUOTE=teslath;29168639]OP probably don't understand :downs:[/QUOTE] [QUOTE=Empty_Shadow;29167596]Can I have some code that works in C that will determine whether a number is prime or not? (preferably a bit more elegant than the most basic bruteforce approach)[/QUOTE] [code] Program that tests IsPrime (Program.cs - C#) using System; class Program { static void Main() { // // Write prime numbers between 0 and 100. // Console.WriteLine("--- Primes between 0 and 100 ---"); for (int i = 0; i < 100; i++) { bool prime = PrimeTool.IsPrime(i); if (prime) { Console.Write("Prime: "); Console.WriteLine(i); } } // // Write prime numbers between 10000 and 10100 // Console.WriteLine("--- Primes between 10000 and 10100 ---"); for (int i = 10000; i < 10100; i++) { if (PrimeTool.IsPrime(i)) { Console.Write("Prime: "); Console.WriteLine(i); } } } } Class that contains IsPrime (PrimeTool.cs - C#) using System; public static class PrimeTool { public static bool IsPrime(int candidate) { // Test whether the parameter is a prime number. if ((candidate & 1) == 0) { if (candidate == 2) { return true; } else { return false; } } // Note: // ... This version was changed to test the square. // ... Original version tested against the square root. // ... Also we exclude 1 at the very end. for (int i = 3; (i * i) <= candidate; i += 2) { if ((candidate % i) == 0) { return false; } } return candidate != 1; } } Output --- Primes between 0 and 100 --- Prime: 2 Prime: 3 Prime: 5 Prime: 7 Prime: 11 Prime: 13 Prime: 17 Prime: 19 Prime: 23 Prime: 29 Prime: 31 Prime: 37 Prime: 41 Prime: 43 Prime: 47 Prime: 53 Prime: 59 Prime: 61 Prime: 67 Prime: 71 Prime: 73 Prime: 79 Prime: 83 Prime: 89 Prime: 97 --- Primes between 10000 and 10100 --- Prime: 10007 Prime: 10009 Prime: 10037 Prime: 10039 Prime: 10061 Prime: 10067 Prime: 10069 Prime: 10079 Prime: 10091 Prime: 10093 Prime: 10099[/code]
Why is the ground brown?
[QUOTE=muffinmastah;29191841]Why is the ground brown?[/QUOTE] Because of carbon. When plants wilt and die, they turn brown. Dead leaves and other parts of the plants fall to the ground. Taking the carbon with it. Then there's a process involving microbes and enzymes which basically 'eat' the carbon, and then them dying, leaving carbon also, so it never really leaves. The [b]carbon[/b] is what makes the ground (soil/dirt) brown.
Dear Rouik, I am writing to you because shit. I am a huge fan of your show by the way. It's TEH LOLZ smiley face. So yesterday I went out with this girl. I really like her, but I don't know if she likes me. There was contact and may I say theres was good chemistry, but I don't know if I should say it or wait for her to say it first. Or just to let it happen. Also, shes not the pretties person I've seen, but she's sweet. Rouik, can you help me with this? Please help me, I think she's the love of my life! Thank you for you time and keep up the good work Rouik! Can you also give a shout out from [url=www.teeboneshirts.com]TeeBone Shirts[/url]? Give a shout out to Dr.Dre too, my good friend, I love The Chronic! Smoke Weed Everyday LBC! Thank you, D3
[QUOTE=Luafox;29202684]Is there something donuts can't do?[/QUOTE] They cannot transport me through space and time. I tested this theory, and for punishment, I ate all the donuts in the box. [QUOTE=D3TBS;29202819]Dear Rouik, I am writing to you because shit. I am a huge fan of your show by the way. It's TEH LOLZ smiley face. So yesterday I went out with this girl. I really like her, but I don't know if she likes me. There was contact and may I say theres was good chemistry, but I don't know if I should say it or wait for her to say it first. Or just to let it happen. Also, shes not the pretties person I've seen, but she's sweet. Rouik, can you help me with this? Please help me, I think she's the love of my life! Thank you for you time and keep up the good work Rouik! Can you also give a shout out from [url=www.teeboneshirts.com]TeeBone Shirts[/url]? Give a shout out to Dr.Dre too, my good friend, I love The Chronic! Smoke Weed Everyday LBC! Thank you, D3[/QUOTE] To be honest, sweetness + some sort of attractiveness will go a lot further than if you chase some dumb hot bitch (not saying there's not sweet/smart/hot 'bitches' but w/e). My advice would be to go out with her again, and then if everything continues smoothly you should then pursue her, and ask her. Girls prefer guys to be the dominant one, especially when it comes to initiating a relationship. Just be equally as sweet and kind in turn, and I highly doubt it will fail. Also, a few nice, but not over the top compliments wouldn't go astray. Compliment her on her clothes and her smile, also her eyes. They're good places to start. [i]Please excuse this telecast, but we have an announcement.[/i] Ever wanted to have the best t-shirt in the room? Now [b]you[/b] can! Simply go to a room by yourself, or buy a t-shirt from TeeBone Shirts! [url]http://www.teeboneshirts.com/[/url] [i]End of announcement[/i] Shoutouts to Dre also, for designing my headphones.
Sorry, you need to Log In to post a reply to this thread.