So, after I saw the Programming Challenge 4.0, I thought it was a time waste:
>arbitrary difficulty ranks >a clusterfuck of libs to install >gui design is always a chore >the scope for some of the tasks is way too big, aka no fast feedback >almost every project turns to a mess, having to plow through pages of documentation
So, I opted for something more doable with minimal resources. Enter Project Euler:
>cli, no gui necessary >no clusterfuck libs, standard libs are enough >still challenging without being a chore
I'll be posting my solutions to the problems. I also thought of the thread as a place that would provide new coders with meaningful goals.
Other than that, questions, solutions and anything else regarding Project Euler goes.
Why post this on Sup Forums though? Sounds like blog material
Angel Taylor
Euler 1
#include
int main(void){ int sum=0; int i=3; while(i
Hunter Ramirez
Lets see if faggot OP can make it past 20 Euler is just math btw
Nicholas Brown
Standard libs are "enough" but if you have decent libs for algorithms and data structures (arbitrary precision numbers, permutations, combinations, primes, various trees and graphs and of course easy type conversions between everything and so on) you'll have much less of an annoying experience.
Isaac Flores
It's not "oiler", it's "yooler". He was swiss, not german
Lucas Hernandez
Maybe it would be interesting. If it gets bumped out, whatever. The files still exist on my hard drive.
Eh, not really blog worthy. Not something really new. But this way I have immediate feedback (not in a support way, more like your-code-is-no-pajeet-level way). Also, no need to maintain a blog site.
Levi Bailey
You really don't need more than the standard library for this. If you're intimidated by dependencies and GUIs to the point that you actively avoid them, it really shows where you need to inprove as a programmer.
You need for an emulator tho. Again reading through SDL. Then you learn SDL doesn't do windows, so you need a wrapper lib. Search around, find zilch because someone used only OpenGL or DirectX for the bindings. Fucked again. Either learn those two or dive into native Windows gui API, which is a clusterfuck itself. See where this is going?
Samuel Moore
Swissfag here. We got many dialects but in current swiss german, quite a few would call it something like ˈɔʏlɐ or ˈɔJ.lər .
But you don't really sweat the details when there's also probably like 200 ways to pronounce details in "owl" ("Eule") or such, and people will regularly lean on that to pronounce your name. Also happens to "smith", "miller" and honestly pretty much everyone here. You need a three letter surname before you probably get ~50% to pronounce it like you yourself would.
Charles Roberts
Euler 2
#include
int main(void){ int sum=0; int next2last=1; int last=2; while(last
Ethan Parker
Euler 3 will be done probably in Lisp, cause it can represent bignums.
Euler 4
#include
int reversenum(int num){ int temp=0; int temp2=num; while(temp2>0){ temp+=temp2%10; temp*=10; temp2/=10; } return temp/10; }
int main(void){ int palindrome=0; int biggestpal=0; int digit1=999; int digit2=999; while(digit1>0){ while(digit2>0){ palindrome=digit1*digit2; if(palindrome-reversenum(palindrome)==0) if(palindrome>biggestpal) biggestpal=palindrome; digit2--; } digit1--; } printf("The largest palindrome product is: %d",biggestpal); return 0; }
Isaac Hill
Indent your shit you fucking degenerate >while ... i += 3 Pathetic
Lucas Sanchez
Euler 5
# include
int main(void){ unsigned int lcm=20; int step=20; int divisor=19; for(;;){ while((lcm%divisor)==0){ divisor--; if(divisor
Jordan Hall
It is properly indented, gets fucked up at copypasting.
Noah Wright
Honestly, how much programming have you done? You sound like you have no clue what you're doing.
Btw, SDL works fine on windows, sounds like its just a problem (you) can't figure out.
Brandon Howard
SDL does work marvelously on Windows, but it just gives you a main window which can only be maximized, minimized and go fullscreen.
Any other elements like drop menus, buttons or textboxes have to be done in SDL itself.
I would put me at beginner level, experiencewise.
Jackson Torres
how do I do euler 8? I think I need to split the number into an array of each digit, but don't know how to do it in c
David Parker
rolling
Kevin Campbell
OP here. I did euler 8, but left it home. Copy paste the digits into a txt file then read from it a byte at a time, ignoring values below 30 (new line and pagefeed values)
Jacob Nelson
That doesnt even work. It counts multiples of fifteen twice.
I would put you at pre-beginner levels, experience wise.
Angel Sanders
what is this?
Andrew Torres
Project Euler is too much of a brainlet filter for me, I only managed to do 1,2, 5,6 and 8 without looking up solutions. I've been working almost 2 years now as a programmer and very rarely I have had to stop and really think something out like when I was doing these problems.
Matthew Wood
Progress page
Luis Jones
this is my code pastebin.com/t6Uq5EDx basically I am putting the number into an array but I have no idea how to store this long number in a variable. Help? >inb4 make it into a string
Ryder Lee
It's been awhile since I've done one of these but I decided to do number 30 in Haskell. It's a pretty slow solution but it works.
digits :: (Integral a) => a -> [a] digits 0 = [] digits x = (x `mod` 10) : digits (x `div` 10)
main :: IO () main = print $ sum $ filter (\x -> x == powerSum x) [2..(5*(9^5))] where powerSum x = sum $ map (^ 5) (digits x)
Angel Murphy
for what?
Jace Anderson
Nigga... Project Euler
Justin Price
>post longer of 140 characters are "blog material"
Hudson Morris
oh are you meant to roll to get these
Nathaniel White
>tfw can only solve problems with 5% difficulty rating