Just curious if anyone else on here does Project Euler.
I started yesterday, solved 1, 5, 6, 7
Project Euler
Just curious if anyone else on here does Project Euler.
I started yesterday, solved 1, 5, 6, 7
Project Euler
Nice. I'm using C, I learn well by doing small projects like this, so I'm hoping to use this to learn C better, since I'm a bit behind in my data structures course right now (but catching up quickly)!
Did you use programming or just straight math? I've used math on 3 of them, but like #7 (find the 10001st prime number) seems like you would require programming to solve. (if there is a way to do it with just math, then you should give me a clue, I'd love to learn that)
Wow, you're much better than me :/ I can't even seem to get a formula to find a given Fibonacci number. I think I'm going to have to do this one with programming.
edit: Actually, in retrospect, I have no idea where to begin, I don't have a datatype large enough to hold 1000 digits. Maybe I could find a way to treat numbers as strings. It's going to take some thinking.
For #25, use Binet's formula. That is the formula that gives the nth Fibonacci number. Then use logs. That is how I done it.
With some trial and error or solving we get n=4782.
Which gives us 999.029410673
We round up, so the first Fibonacci number with 1000 digits is the 4782nd one.
Then we have
This tells us the first digit of this huge number is 1.
Did you use programming or just straight math? I've used math on 3 of them, but like #7 (find the 10001st prime number) seems like you would require programming to solve. (if there is a way to do it with just math, then you should give me a clue, I'd love to learn that)
Well the 10001 prime problem is trivial if you already have tools for handling
primes. First the 10001st prime ~ 100000 so it is well withing the capabilities
of a modern computer. It takes my computer 16 ms to find all the primes less
than 200000, and no time at all for me to pick out the correct one from the
~18000 primes found. (and this is an interpreted system!)
In fact it would take more time to look the answer up in a table of primes!
RonL
Hmm, I spent the last day writing a program to find primes (my program is beautiful, btw). I timed it to 200,000 primes in about 3 seconds. Now I'm trying to figure out how to install GNU Multiple Precision Arithmetic Library so that I can answer #3, because I don't currently have any data types large enough to handle numbers that big.
^_^ I've gottan 16 so far. There are more that I can do, but I've decided that C is not a very good language, I frequently can't handle large enough numbers. I had downloaded a library to do it, but this required comlicated functions, and any operation at all which involved a number had it's own new function, (printing, adding, subtracting, dividing, etc) it took me 30 minutes to figure out how to divide and print out the answer :/ Also, it is a pain to read in files (I assume because windows .txt files have formatting or something, but I can make a similar file on linux and read it in correctly, then I import their .txt file and the reader won't work right, and I have to mess with it for an hour to get the file read in, then get it solved in under 20 minutes)
So I'm picking up Ruby, then I'll try the others I have ideas about. Some of them I could solve now, like #3 by just plugging it into a prime factorizer, but I want to do them on my own, so I'm waiting on these. Others, like 181, I need to go back and reread ch 5 in my Discrete Mathematics book to be able to solve, but my schoolwork is pretty intense right now so I've decided to do that over Spring Break instead. And most of these will have to wait until then as well, though every now and then I find one I can solve in excel in about 10 minutes.
Sorry >.< I've gotten a total of 18, though not in order. I haven't worked on it in a bit, because I had midterms last week, and a big project due in my Data Structures and Algorithms course at the end of this week, plus I'm a little frustrated with C, so I decided to learn Ruby to do the rest. I got 2 books on Ruby last week, but I'm going to wait until after I get my project done.
Oh, and I'm going to reread ch5 in my Discrete Mathematics book, which is all about counting, there are so many problems on there that deal with counting that I can't get right now, that's kind of frustring to me, because they seem like they should be easy.
Anyway, yeah, it is pretty addicting, but school is important enough to me that I've been able to put it off (school is also the only thing in 9 years that could get me to say "no" to my starcraft addiction). Best of luck to you in that regardsand if you can't say no, there's also the other option: solve all the problems and there won't be any left
![]()
I like the site but the problems usually are not all that interesting. I instead do problems on SPOJ (www.spoj.pl), just click problems in the left panel. I should warn that the problems are not listed in order by difficulty but rather by date added. thus you should sort the problems by the number of users that have solved them to get a better idea of difficulty.
So far I have done 55 problems, using Ruby and C.
(Sometimes I use excel, sometimes pen/paper)
These are the ones I have done
green = solved
red = unsolved
(55/199)
001, 002, 003, 004, 005, 006, 007, 008, 009, 010,
011, 012, 013, 014, 015, 016, 017, 018, 019, 020,
021, 022, 023, 024, 025, 026, 027, 028, 029, 030,
031, 032, 033, 034, 035, 036, 037, 038, 039, 040,
041, 042, 043, 044, 045, 046, 047, 048, 049, 050,
051, 052, 053, 054, 055, 056, 057, 058, 059, 060,
061, 062, 063, 064, 065, 066, 067, 068, 069, 070,
071, 072, 073, 074, 075, 076, 077, 078, 079, 080,
081, 082, 083, 084, 085, 086, 087, 088, 089, 090,
091, 092, 093, 094, 095, 096, 097, 098, 099, 100,
101, 102, 103, 104, 105, 106, 107, 108, 109, 110,
111, 112, 113, 114, 115, 116, 117, 118, 119, 120,
121, 122, 123, 124, 125, 126, 127, 128, 129, 130,
131, 132, 133, 134, 135, 136, 137, 138, 139, 140,
141, 142, 143, 144, 145, 146, 147, 148, 149, 150,
151, 152, 153, 154, 155, 156, 157, 158, 159, 160,
161, 162, 163, 164, 165, 166, 167, 168, 169, 170,
171, 172, 173, 174, 175, 176, 177, 178, 179, 180,
181, 182, 183, 184, 185, 186, 187, 188, 189, 190,
191, 192, 193, 194, 195, 196, 197, 198, 199, 200,