Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

WEEKLY CHALLENGE

Name: Anonymous 2010-08-25 18:17

/prog/'s weekly challenge

Write a solution to Project Euler's first problem (http://projecteuler.net/index.php?section=problems&id=1)
using the befunge93 language (http://catseye.tc/projects/befunge93/doc/befunge93.html).

Name: Anonymous 2010-08-25 21:06

main = print $ sum $ filter (\x -> x `mod` 3 == 0 || x `mod` 5 == 0) [1 .. 1000]

HASKAL > BEFUNGE LOL

Name: Anonymous 2010-08-25 21:18

Not befunge, but here's one simple CL solution:
(loop for i from 1 to 1000 when (or (zerop (mod i 3)) (zerop (mod i 5))) sum i)

Name: Anonymous 2010-08-25 21:44

Fine then, Perl 6 confirmed for toy language:
[+] ( for ^1000 { $^a %% any(3,5) ?? $a !! 0 } )

My fist stab at golfing this made it return (and sum) junctions, which is a not so subtle clue to stop. In other news, Rakudo Star will happily reduce junctions in the least-efficient-yet-technically-correct manner plausible.

Name: >>5 2010-08-26 1:24

>>6
You've got way too much time to spare. Maybe you should try getting a job.

>>7
Thanks!

>>8
You should really reconsider the normality of your relationship with your mother.

Name: Anonymous 2010-08-26 4:01

It's odd that there's a "challenge" that involves finding multiples of 5 and 3.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List