Flash Flash Revolution

Flash Flash Revolution (http://www.flashflashrevolution.com/vbz/index.php)
-   Technology (http://www.flashflashrevolution.com/vbz/forumdisplay.php?f=74)
-   -   The Project Euler thread (http://www.flashflashrevolution.com/vbz/showthread.php?t=120818)

Choofers 07-16-2013 07:23 PM

Re: The Project Euler thread
 
got problem 6 with no trouble, started on 14 and I had a working script for it but I think it was optimized terribly because after 15 minutes it still wasn't giving me results

whoops

Choofers 07-19-2013 03:40 PM

Re: The Project Euler thread
 
yeah I brute forced the fuck out of 14

now I'm doing problem 5 and I'm not sure where I'm fucking up, haven't touched arrays in years

edit: talked to one of the instructors, fixed the code and now I'm waiting xd
I really need to get back into math

kaiten123 07-19-2013 05:10 PM

Re: The Project Euler thread
 
Quote:

Originally Posted by Choofers (Post 3941751)
yeah I brute forced the fuck out of 14

now I'm doing problem 5 and I'm not sure where I'm fucking up, haven't touched arrays in years

edit: talked to one of the instructors, fixed the code and now I'm waiting xd
I really need to get back into math

a clever solution to 5 shouldnt require arrays or waiting. the problem is basically asking for a least common multiple, try thinking of efficient ways of finding those. once you have a solution you could punch it into a calculator (or write a bit of code) and have the answer almost instantly.

Arkuski 08-8-2013 12:52 PM

Re: The Project Euler thread
 
Learned Matlab for the past few weeks and now I'm crunching this stuff in Octave

kaiten123 09-3-2013 03:04 PM

Re: The Project Euler thread
 
Decimation :)

klimtkiller 11-29-2013 02:56 PM

Re: The Project Euler thread
 
yay

Reincarnate 11-29-2013 11:08 PM

Re: The Project Euler thread
 
Oh how those green checkmarks make you feel warm and fuzzy inside

Zapmeister 02-2-2014 04:53 PM

Re: The Project Euler thread
 
so today i remembered i had an account on this thing with 26 solved that i hadn't touched in over three years.

up to 60 now, running out of easy ones really fast. let's see how this goes. even if nothing happens it'll probably be a more productive use of my spare time than cookie clicker or messing around with bitcoin faucets

i was the 30000th person to do #38 yay

evanescence_death4ever 02-2-2014 06:25 PM

Re: The Project Euler thread
 
I think...I'm going to start this. O_O Time to fail.

lilylily608 05-12-2014 09:18 PM

Re: The Project Euler thread
 
I will be going in linear order from start to finish!

sweet2kill210 05-15-2014 02:57 PM

Re: The Project Euler thread
 
hmmm, I managed to do the first 5 in python a while back. BUT I will try to get through more later because next semester I'm taking a college class for C++ which I've been wanting to learn for a long time. :)

rushyrulz 05-15-2014 06:50 PM

Re: The Project Euler thread
 
Quote:

Originally Posted by lilylily608 (Post 4134416)
I will be going in linear order from start to finish!

you won't finish sorry.

leonid 05-15-2014 06:56 PM

Re: The Project Euler thread
 
who knows.

Reincarnate 05-15-2014 07:42 PM

Re: The Project Euler thread
 
leonid you have not solved a problem in... almost 900 days.

tear

Guest15937 05-15-2014 10:55 PM

Re: The Project Euler thread
 
I've done about 70 of them, going in order from most solved to least solved.

reuben_tate 05-16-2014 12:07 AM

Re: The Project Euler thread
 
Decided to start doing this again. Going to start from the beginning because I know when I first started my solutions were crap. I used my favorite programming language for this one:


Some actual code:

Code:

/*
* We use the fact that 3+6+9+12+... = 3(1+2+3+..) from which we can
* use the n(n+1)/2 formula for the sum of the first n positve integers
*/
      int a = 999/3; //number of multiples of 3 less than 1000
      int b = 999/5; //number of multiples of 5 less than 1000
      int c = 999/15; //number of multiples of 15 less than 1000
      System.out.println(3*(a)*(a+1)/2+5*(b)*(b+1)/2-15*(c)*(c+1)/2);



reuben_tate 05-16-2014 07:24 AM

Re: The Project Euler thread
 
Ok, screw the whole going in order thing, I'm just going to do problems I haven't done yet haha. This was a nice paper-n-pencil-n-calculator one as well :) Level 1 get.

rushyrulz 05-16-2014 07:36 AM

Re: The Project Euler thread
 
I tend to just brute force everything :/






stargroup100 05-21-2014 12:14 AM

Re: The Project Euler thread
 
Quote:

Originally Posted by rushyrulz (Post 4136121)
I tend to just brute force everything :/
*solution to problem nine*

if you haven't done these kinds of problems with pencil/paper you should try it

the first time you realize how to do it it's quite enlightening and exciting

leonid 05-21-2014 12:18 AM

Re: The Project Euler thread
 
pencil&paper will only get you so far

Reincarnate 05-21-2014 06:59 AM

Re: The Project Euler thread
 
Not every problem can be done with pencil and paper.

leonid 05-21-2014 11:53 AM

Re: The Project Euler thread
 


Rubix sent me to solve this

A bit of paperwork and then lots of wolframalpha

Reincarnate 05-21-2014 03:15 PM

Re: The Project Euler thread
 
Nicely done

stargroup100 05-21-2014 03:34 PM

Re: The Project Euler thread
 
sorry I should've been more clear

I was referring to problem nine specifically, involving pythagorean triples

rushyrulz 05-21-2014 06:31 PM

Re: The Project Euler thread
 
brute forcing 12 and it's not going so well. I'm almost an hour in and still no solution.
Code:

The sequence of triangle numbers is generated by adding the natural numbers.
So the 7th triangle number would be 1 + 2 + 3 + 4 + 5 + 6 + 7 = 28. The first ten terms would be:

1, 3, 6, 10, 15, 21, 28, 36, 45, 55, ...

Let us list the factors of the first seven triangle numbers:

 1: 1
 3: 1,3
 6: 1,2,3,6
10: 1,2,5,10
15: 1,3,5,15
21: 1,3,7,21
28: 1,2,4,7,14,28
We can see that 28 is the first triangle number to have over five divisors.

What is the value of the first triangle number to have over five hundred divisors?

In hindsight, I probably would have used a much more efficient factor breakdown algorithm had I known it would take this long.

Reincarnate 05-21-2014 06:59 PM

Re: The Project Euler thread
 
using brute force = not very interesting

usually more fun to try for the faster approaches

rushyrulz 05-21-2014 07:09 PM

Re: The Project Euler thread
 
I'm sure there's a very elegant mathematical solution for all of these, but I'm just trying to get as far as I can :P

stargroup100 05-21-2014 07:19 PM

Re: The Project Euler thread
 
I did the first 30 (excluding 12) and even a couple of the 300+ ones before I figured out 12. I don't know why but that one was hard for me

rushyrulz 05-21-2014 07:34 PM

Re: The Project Euler thread
 
Probably since there are so many different things you need to account for in 12. Not only do you need a gigantic 500+ factor number, but it also needs to be a summation of n number which is tricky to check for.

Guest15937 05-21-2014 07:42 PM

Re: The Project Euler thread
 
My brute force of 12 took 15 seconds to run.

beary605 05-21-2014 07:52 PM

Re: The Project Euler thread
 
does project euler ever teach you algorithms, e.x. dynamic programming, breadth/depth first search

rushyrulz 05-21-2014 08:18 PM

Re: The Project Euler thread
 
Project Euler doesn't directly 'teach' you anything.

beary605 05-21-2014 08:23 PM

Re: The Project Euler thread
 
Quote:

Originally Posted by rushyrulz (Post 4138341)
Project Euler doesn't directly 'teach' you anything.

rephrasing question then

does project euler ever REQUIRE you to know algorithms, e.x. dynamic programming, breadth/depth first search

rushyrulz 05-21-2014 08:32 PM

Re: The Project Euler thread
 
It's basically algorithm development, and if dynamic programming, breadth/depth first search is required for efficiency sake, then yes.

Also, rewrote my factorization algorithm and I solved 12 in 5 seconds :P

Reincarnate 05-21-2014 08:43 PM

Re: The Project Euler thread
 
Quote:

Originally Posted by beary605 (Post 4138326)
does project euler ever teach you algorithms, e.x. dynamic programming, breadth/depth first search

absolutely

even more so once you start venturing into the harder stages (where the problems also become much more interesting)

DP, especially, is used quite often

Reincarnate 05-21-2014 08:44 PM

Re: The Project Euler thread
 
For example, try your hand at any of these:



http://projecteuler.net/problem=161
http://projecteuler.net/problem=425
http://projecteuler.net/problem=442

Reincarnate 05-21-2014 08:49 PM

Re: The Project Euler thread
 
And of course, (some) of the big kahunas that will require both mathematical and programmatical sorcery:

http://projecteuler.net/problem=289
http://projecteuler.net/problem=328
http://projecteuler.net/problem=344
http://projecteuler.net/problem=361
http://projecteuler.net/problem=415

rushyrulz 05-21-2014 08:52 PM

Re: The Project Euler thread
 
you almost have to be too smart...

stargroup100 05-21-2014 08:57 PM

Re: The Project Euler thread
 
ohhhh the eulerian circle one looks cool

really tempted to try that one lol

beary605 05-21-2014 08:57 PM

Re: The Project Euler thread
 
ohoho this will be fun, i should get back to project euler

Reincarnate 05-21-2014 09:06 PM

Re: The Project Euler thread
 
also, honorable mention for just being a really cool and interesting problem with an elegant solution:

http://projecteuler.net/problem=202

axith 05-21-2014 09:13 PM

Re: The Project Euler thread
 
Project Euler makes me feel dumb. I do appreciate the math tidbits that I'm forced to look up though. I had no clue of Euler's Totient function and many number theory ideas before messing with the problems.

leonid 05-21-2014 09:32 PM

Re: The Project Euler thread
 
http://projecteuler.net/problem=144

I still need to solve this one

AutotelicBrown 05-22-2014 04:12 AM

Re: The Project Euler thread
 


Those problems are fun. I'll try 328 later.

stargroup100 05-25-2014 01:50 AM

Re: The Project Euler thread
 
The latest problem, 473, looks really fun. http://projecteuler.net/problem=473

Right after reading it, I feel like finding the phidigital representation of an integer is NP complexity class. However, given the nature of these problems and the limit they ask for, I'm guessing there's some brilliant trick here.

EDIT: PFFFFT the trick was so stupidly obvious im dumb

stargroup100 05-25-2014 03:40 PM

Re: The Project Euler thread
 
This problem is still hard as balls though. The "obvious" algorithm doesn't really help you compute anything efficiently, at least not without some heavy-duty work put onto it.

rushyrulz 05-28-2014 08:29 PM

Re: The Project Euler thread
 
Code:

Problem 17

If the numbers 1 to 5 are written out in words: one, two, three, four, five, then there are
3 + 3 + 5 + 4 + 4 = 19 letters used in total.

If all the numbers from 1 to 1000 (one thousand) inclusive were written out in words, how many
letters would be used?

NOTE: Do not count spaces or hyphens. For example, 342 (three hundred and forty-two) contains
23 letters and 115 (one hundred and fifteen) contains 20 letters. The use of "and" when writing out
numbers is in compliance with British usage.



this one was a recursive nightmare, almost wanted to pencil and paper it.

stargroup100 05-29-2014 02:37 AM

Re: The Project Euler thread
 
Quote:

Originally Posted by rushyrulz (Post 4142267)
Code:

Problem 17

If the numbers 1 to 5 are written out in words: one, two, three, four, five, then there are
3 + 3 + 5 + 4 + 4 = 19 letters used in total.

If all the numbers from 1 to 1000 (one thousand) inclusive were written out in words, how many
letters would be used?

NOTE: Do not count spaces or hyphens. For example, 342 (three hundred and forty-two) contains
23 letters and 115 (one hundred and fifteen) contains 20 letters. The use of "and" when writing out
numbers is in compliance with British usage.



this one was a recursive nightmare, almost wanted to pencil and paper it.

fyi a pencil and paper solution could take less than 10 min LOL

leonid 06-1-2014 01:16 AM

Re: The Project Euler thread
 
That was easier than I feared, but it still took me a couple hours to come up with the right code


leonid 06-1-2014 04:32 AM

Re: The Project Euler thread
 


PARI/GP rocks

leonid 06-1-2014 05:15 AM

Re: The Project Euler thread
 


I'm on fire

stargroup100 06-1-2014 06:32 AM

Re: The Project Euler thread
 
Quote:

Originally Posted by leonid (Post 4143880)


PARI/GP rocks

that thing is fucking amazing

I put it on my phone LOL

leonid 06-1-2014 06:52 AM

Re: The Project Euler thread
 


Used Ruby this time

rushyrulz 06-1-2014 04:54 PM

Re: The Project Euler thread
 
Quote:

Originally Posted by stargroup100 (Post 4142360)
fyi a pencil and paper solution could take less than 10 min LOL

I'm aware, but I am not doing this because I want fast solutions, I'm doing this to strengthen my programming skills.

Just like how problem 19 (how many Sundays occurred on the first day of the month in the 20th century?) could be easily guessed by
Math.round(100*12/7) = 171
, but I wrote a program for it anyway.

Reincarnate 06-1-2014 05:16 PM

Re: The Project Euler thread
 
The first 100 problems are pretty simple

Try some later problems for more of a challenge

rushyrulz 06-1-2014 05:50 PM

Re: The Project Euler thread
 
I'm having a hoot with the first 100 for now D:

igotrhythm 06-1-2014 08:54 PM

Re: The Project Euler thread
 
90% of these have me saying "I wish I knew how to solve this problem period, let alone write a program to solve it."

leonid 06-1-2014 09:23 PM

Re: The Project Euler thread
 


Dynamic programming

leonid 06-1-2014 10:41 PM

Re: The Project Euler thread
 


Another DP
Ruby is slow..

leonid 06-2-2014 12:27 AM

Re: The Project Euler thread
 


~_~

reuben_tate 06-2-2014 12:30 AM

Re: The Project Euler thread
 
leonid on a roll

beary605 06-2-2014 01:25 AM

Re: The Project Euler thread
 
right after 100 you get slapped with special subset sums

man it will be hard to find the tricks for working with these

leonid 06-2-2014 05:36 AM

Re: The Project Euler thread
 


Took me a while

leonid 06-2-2014 06:53 AM

Re: The Project Euler thread
 


lol this problem :P

Reincarnate 06-2-2014 07:10 AM

Re: The Project Euler thread
 
Best answer ever

LongGone 06-2-2014 09:07 AM

Re: The Project Euler thread
 
Quote:

Originally Posted by Reincarnate (Post 4144484)
Best answer ever

Goddamnit

leonid 06-2-2014 03:58 PM

Re: The Project Euler thread
 


woot

kaiten123 06-2-2014 10:24 PM

Re: The Project Euler thread
 
Quote:

Originally Posted by leonid (Post 4144481)
lol this problem :P

Quote:

Originally Posted by Reincarnate (Post 4144484)
Best answer ever

Quote:

Originally Posted by LongGone (Post 4144495)
Goddamnit

wow, i wonder what kind of problem/answer these guys are talking about


oh.... wwwooooww

leonid 06-2-2014 11:03 PM

Re: The Project Euler thread
 


Level 9 (O:

beary605 06-2-2014 11:26 PM

Re: The Project Euler thread
 
http://projecteuler.net/problem=66, diophantine equation
i remember trying to solve this one on pencil and paper
the facepalm i got after googling it was huge

leonid 06-3-2014 06:14 AM

Re: The Project Euler thread
 


That was really tough

Reincarnate 06-3-2014 07:37 AM

Re: The Project Euler thread
 
I also recall 177 being pretty hard for being an earlier problem

leonid 06-3-2014 07:54 AM

Re: The Project Euler thread
 
I'm just knocking out unsolved problems with most solvers



Easy

leonid 06-4-2014 12:19 AM

Re: The Project Euler thread
 


yess

leonid 06-4-2014 02:47 AM

Re: The Project Euler thread
 


hue hue

leonid 06-4-2014 03:36 AM

Re: The Project Euler thread
 


woohoo

stargroup100 06-4-2014 04:01 AM

Re: The Project Euler thread
 
leonid blasting through these

leonid 06-4-2014 06:25 AM

Re: The Project Euler thread
 


fun

stargroup100 06-4-2014 07:31 AM

Re: The Project Euler thread
 
after all of the fuss about problem 218 I decided to take a look for myself

as soon as I saw the problem I knew my method of approach. so excited to try this right now

EDIT: so after 30 min of pencil/paper I realized that I didn't even need to write any code

WHAT THE FUCK IS THAT SHIT



this question is fucking troll

stargroup100 06-4-2014 10:01 AM

Re: The Project Euler thread
 
ugh I really need to know how to code more efficiently and faster. I'm trying to blow through the early problems, and while they're obnoxiously easy, I find myself writing a lot of code, which ends up taking up a lot of time

often times my pencil/paper method is faster -__-


like for example, #35 asks to count up circular primes below 1 mil. code is approx 100 lines long, with the following output:

Code:

Took 0.485 seconds to generate prime list up to 1000000. problem35.html:46
For 11, all digit rotations are prime: 11 problem35.html:100
For 13, all digit rotations are prime: 13,31 problem35.html:100
For 17, all digit rotations are prime: 17,71 problem35.html:100
For 37, all digit rotations are prime: 37,73 problem35.html:100
For 79, all digit rotations are prime: 79,97 problem35.html:100
...
A total of ????? circular primes. problem35.html:111
Took 0.862 seconds.



im bad ;_;


All times are GMT -5. The time now is 08:31 AM.

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright FlashFlashRevolution