Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,148,635 members, 7,801,833 topics. Date: Friday, 19 April 2024 at 01:18 AM |
Nairaland Forum / Science/Technology / Programming / Coding Challenge 3: Sum Of Primes (3903 Views)
Mini Web Application Coding Challenge For Programmers / Java Coding Challenge: Task Scheduler / Coding Challenge 5: Substring Generator (2) (3) (4)
Coding Challenge 3: Sum Of Primes by Fayimora(m): 10:04am On Jul 06, 2011 |
Challenge The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17. Your task is to find the sum of all the primes below two million. Time limit: nil Goodluck, |
Re: Coding Challenge 3: Sum Of Primes by Nobody: 4:49pm On Jul 06, 2011 |
Re: Coding Challenge 3: Sum Of Primes by dellnet: 7:13pm On Jul 06, 2011 |
Little cheat. #include <windows.h> |
Re: Coding Challenge 3: Sum Of Primes by Nobody: 7:30pm On Jul 06, 2011 |
Re: Coding Challenge 3: Sum Of Primes by dellnet: 7:35pm On Jul 06, 2011 |
yes it takes forever, #1. Just comment the windows header file and the last line. |
Re: Coding Challenge 3: Sum Of Primes by Nobody: 7:45pm On Jul 06, 2011 |
Re: Coding Challenge 3: Sum Of Primes by dellnet: 8:32pm On Jul 06, 2011 |
// Outputs 142913828922 to the standard output stream. what do you mean? |
Re: Coding Challenge 3: Sum Of Primes by Nobody: 8:54pm On Jul 06, 2011 |
Re: Coding Challenge 3: Sum Of Primes by Fayimora(m): 9:15pm On Jul 06, 2011 |
Yeah the answer is 142913828922 Here is my code: class SumOfPrimes @Dell and omo_to_dun, how long did it take your code to compute this? |
Re: Coding Challenge 3: Sum Of Primes by Nobody: 9:49pm On Jul 06, 2011 |
|
Re: Coding Challenge 3: Sum Of Primes by Fayimora(m): 10:19pm On Jul 06, 2011 |
hahaha you dont want to kno mine, How did you compute that time? UNIX feature or C |
Re: Coding Challenge 3: Sum Of Primes by Nobody: 10:24pm On Jul 06, 2011 |
Re: Coding Challenge 3: Sum Of Primes by Fayimora(m): 11:36pm On Jul 06, 2011 |
Yeah it wud and yope the brute force, I use a Mac, wats d syntax? or rather how o i go about it, I normally use my text editor(TextMate). |
Re: Coding Challenge 3: Sum Of Primes by Nobody: 12:05am On Jul 07, 2011 |
Re: Coding Challenge 3: Sum Of Primes by Fayimora(m): 12:50am On Jul 07, 2011 |
hahaha yeah i type faster than my static keyboard now adays(effects of recursion), Was asking for the syntax for getting the run time of the program |
Re: Coding Challenge 3: Sum Of Primes by tundebabzy: 12:54am On Jul 07, 2011 |
hahaha. This is a project euler question |
Re: Coding Challenge 3: Sum Of Primes by Nobody: 1:21am On Jul 07, 2011 |
Re: Coding Challenge 3: Sum Of Primes by Fayimora(m): 1:24am On Jul 07, 2011 |
tundebabzy: So i heard I have a document filled with some terrible questions, these are the easy ones on the document, lmao |
Re: Coding Challenge 3: Sum Of Primes by Fayimora(m): 1:28am On Jul 07, 2011 |
Is that it? |
Re: Coding Challenge 3: Sum Of Primes by Nobody: 3:44am On Jul 07, 2011 |
Re: Coding Challenge 3: Sum Of Primes by Fayimora(m): 3:48am On Jul 07, 2011 |
Yaay! thanks that worked! So which is real, user and sys. What does each calculate |
Re: Coding Challenge 3: Sum Of Primes by Nobody: 4:02am On Jul 07, 2011 |
Re: Coding Challenge 3: Sum Of Primes by dellnet: 5:10am On Jul 07, 2011 |
@Fayimora, you dont really want to know how long it takes @omo, My systems both Linux and Windows output something different from your script.
|
Re: Coding Challenge 3: Sum Of Primes by Nobody: 6:00am On Jul 07, 2011 |
Re: Coding Challenge 3: Sum Of Primes by Mobinga: 4:02pm On Jul 07, 2011 |
omo_to_dun: Wuss. |
Re: Coding Challenge 3: Sum Of Primes by Nobody: 4:17pm On Jul 07, 2011 |
Re: Coding Challenge 3: Sum Of Primes by Mobinga: 8:23pm On Jul 07, 2011 |
Nope. Here it is http://en.wikipedia.org/wiki/Sieve_of_Sundaram |
Re: Coding Challenge 3: Sum Of Primes by Nobody: 8:56pm On Jul 07, 2011 |
Re: Coding Challenge 3: Sum Of Primes by Mobinga: 9:17pm On Jul 07, 2011 |
omo_to_dun:I'm doing it, but its maxing out one out of four cores! Kinda like an infinite loop. Anyway, I'm still trying, don't want to steal anything off the internet. |
Re: Coding Challenge 3: Sum Of Primes by Nobody: 9:42pm On Jul 07, 2011 |
Re: Coding Challenge 3: Sum Of Primes by Mobinga: 9:55pm On Jul 07, 2011 |
omo_to_dun: Honestly, its both. It improves everything, from gta iv to boot time. @fayimora your code is still compiling, 3 minutes gone. |
Re: Coding Challenge 3: Sum Of Primes by Mobinga: 10:33pm On Jul 07, 2011 |
Phucking Hell.
|
University/Polytechnic Web Portal: What Features Would You Love? / What Is The URL For Jumia Seller Centre API / Test Your Knowledge Of Excel On This
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 19 |