Project Euler Marathon

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.

Attached: euler.jpg (460x595, 42K)

Other urls found in this thread:

pastebin.com/t6Uq5EDx
twitter.com/NSFWRedditImage

Why post this on Sup Forums though?
Sounds like blog material

Euler 1

#include

int main(void){
int sum=0;
int i=3;
while(i

Lets see if faggot OP can make it past 20
Euler is just math btw

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.

It's not "oiler", it's "yooler". He was swiss, not german

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.

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.

Like nigga, JavaScript monkeys can grok this shit

Attached: 1473351054855.png (3840x2160, 1.61M)

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?

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.

Euler 2

#include

int main(void){
int sum=0;
int next2last=1;
int last=2;
while(last

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;
}

Indent your shit you fucking degenerate
>while ... i += 3
Pathetic

Euler 5

# include

int main(void){
unsigned int lcm=20;
int step=20;
int divisor=19;
for(;;){
while((lcm%divisor)==0){
divisor--;
if(divisor

It is properly indented, gets fucked up at copypasting.

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.

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.

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

rolling

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)

That doesnt even work. It counts multiples of fifteen twice.

ITT: Plebs

Attached: Screenshot_20180324-170104.jpg (1021x1997, 863K)

#include

int main(void) {
int sum=0;
int i=3;
while(i

I would put you at pre-beginner levels, experience wise.

what is this?

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.

Progress page

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

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)

for what?

Nigga...
Project Euler

>post longer of 140 characters are "blog material"

oh are you meant to roll to get these

>tfw can only solve problems with 5% difficulty rating

Attached: euler.png (617x506, 49K)

Why on earth would you store the number as, well, a number, when youre only concerned with its individual digits?

Also, here's 8 in J
>./ 13 */\ "."0 ; cutLF num
23514624000

Where num is a string containing the raw text of the number.

>Programming Challenge 4.0 includes general programming stuff
>Project Euler exclusively maths
two different things op

All of these sans fizzbuzz are too fucking hard, what the shit.
Rolling for fuck you tier

The programming challenge doesn't compare to Project Euler because Project Euler is a bunch of math problems you can do in whatever the fuck you like

roll for challenge I probably won't even do

Attached: 1271833348272.jpg (628x597, 29K)

some of the green ones are pretty easy.
>count occurrences of a character in a string