Our server costs ~$56 per month to run. Please consider donating or becoming a Patron to help keep the site running. Help us gain new members by following us on Twitter and liking our page on Facebook!
Current time: January 24, 2022, 7:11 pm

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Project Euler
#1
Project Euler
For you lovers of programming and mathematics, here's a cool site for you with fun exercises to complete and progress tracked (if you sign up to the site first)::

https://projecteuler.net/

Up to Problem 20 now. Who here can beat me? Tongue
Reply
#2
RE: Project Euler
Oooh... I like.

I solved the first two pretty quickly.

Using C++.
"There remain four irreducible objections to religious faith: that it wholly misrepresents the origins of man and the cosmos, that because of this original error it manages to combine the maximum servility with the maximum of solipsism, that it is both the result and the cause of dangerous sexual repression, and that it is ultimately grounded on wish-thinking." ~Christopher Hitchens, god is not Great

PM me your email address to join the Slack chat! I'll give you a taco(or five) if you join! --->There's an app and everything!<---
Reply
#3
RE: Project Euler
(June 26, 2016 at 4:35 am)SteelCurtain Wrote: Oooh... I like.

I solved the first two pretty quickly.

Using C++.

I'm using Python: the programming language for lazy people like me who don't want to type parentheses or braces more than they should.
Reply
#4
RE: Project Euler
I thought about using Python, but the C++ online shell has a shorter URL... Tongue

http://cpp.sh
"There remain four irreducible objections to religious faith: that it wholly misrepresents the origins of man and the cosmos, that because of this original error it manages to combine the maximum servility with the maximum of solipsism, that it is both the result and the cause of dangerous sexual repression, and that it is ultimately grounded on wish-thinking." ~Christopher Hitchens, god is not Great

PM me your email address to join the Slack chat! I'll give you a taco(or five) if you join! --->There's an app and everything!<---
Reply
#5
RE: Project Euler
(June 26, 2016 at 4:40 am)SteelCurtain Wrote: I thought about using Python, but the C++ online shell has a shorter URL... Tongue

cpp.sh

This looks really neat.

I'm using:
https://repl.it/

Up to Problem 23, but need to take a break now. I'll figure out tomorrow a way to solve that problem without crashing the browser.
Reply
#6
RE: Project Euler
Seriously, these are fun and challenging.

Usually, my code is pretty hacky because I don't care about anything but the result, but I love these challenges.
"There remain four irreducible objections to religious faith: that it wholly misrepresents the origins of man and the cosmos, that because of this original error it manages to combine the maximum servility with the maximum of solipsism, that it is both the result and the cause of dangerous sexual repression, and that it is ultimately grounded on wish-thinking." ~Christopher Hitchens, god is not Great

PM me your email address to join the Slack chat! I'll give you a taco(or five) if you join! --->There's an app and everything!<---
Reply
#7
RE: Project Euler
(June 28, 2016 at 4:58 am)SteelCurtain Wrote: Seriously, these are fun and challenging.

Usually, my code is pretty hacky because I don't care about anything but the result, but I love these challenges.

Where you up to, Steel?

If by hacky, you mean running fragments of code, extracting the intermediate answers, and then using those answers as part of the data for the final code, then yep, that's what I did for a couple of them thus far.
Reply
#8
RE: Project Euler
I'm working on #12 right now.

I'm on a slow shitty computer at work using Python and IDLE now. The summation of primes problem was too much for the online shells, they time out after like 5 seconds, the stingy bastards. Hard to sum all of the primes below 2,000,000 in 5 seconds with an online shell.

Now I am finding all of the divisors in triangle numbers, finding the first triangle number with more than 500 divisors. The code was easy, but it's been running for quite a time. I've tried to make it as economical as possible, but I don't care to think too hard about it. Smile

That's what I mean by hacky: maybe not the most efficient code, and that's why this is good practice. I am trying to loop as few times as possible when having nested loops running two million times.
"There remain four irreducible objections to religious faith: that it wholly misrepresents the origins of man and the cosmos, that because of this original error it manages to combine the maximum servility with the maximum of solipsism, that it is both the result and the cause of dangerous sexual repression, and that it is ultimately grounded on wish-thinking." ~Christopher Hitchens, god is not Great

PM me your email address to join the Slack chat! I'll give you a taco(or five) if you join! --->There's an app and everything!<---
Reply
#9
RE: Project Euler
(July 3, 2016 at 1:52 am)SteelCurtain Wrote: I'm working on #12 right now.

I'm on a slow shitty computer at work using Python and IDLE now. The summation of primes problem was too much for the online shells, they time out after like 5 seconds, the stingy bastards. Hard to sum all of the primes below 2,000,000 in 5 seconds with an online shell.

Now I am finding all of the divisors in triangle numbers, finding the first triangle number with more than 500 divisors. The code was easy, but it's been running for quite a time. I've tried to make it as economical as possible, but I don't care to think too hard about it. Smile

That's what I mean by hacky: maybe not the most efficient code, and that's why this is good practice. I am trying to loop as few times as possible when having nested loops running two million times.

Can I give you a hint on how to deal with primes in the case of very large numbers?
Reply
#10
RE: Project Euler
Sure!

To be clear, I didn't actually loop through every number. I skipped evens, and I didn't check for factors after 1/3 of the number I was checking.
"There remain four irreducible objections to religious faith: that it wholly misrepresents the origins of man and the cosmos, that because of this original error it manages to combine the maximum servility with the maximum of solipsism, that it is both the result and the cause of dangerous sexual repression, and that it is ultimately grounded on wish-thinking." ~Christopher Hitchens, god is not Great

PM me your email address to join the Slack chat! I'll give you a taco(or five) if you join! --->There's an app and everything!<---
Reply



Possibly Related Threads...
Thread Author Replies Views Last Post
  [Euler] Need clarification shadowdancer 11 3144 November 22, 2011 at 2:17 am
Last Post: shadowdancer



Users browsing this thread: 1 Guest(s)