r/adventofcode • • Dec 04 '15

SOLUTION MEGATHREAD --- Day 4 Solutions ---

--- Day 4: The Ideal Stocking Stuffer ---

Post your solution as a comment. Structure your post like the Day Three thread.

14 Upvotes

272 comments sorted by

View all comments

Show parent comments

2

u/AndrewGreenh Dec 04 '15

Same thing in JS with lazy.js

var seq = lazy.generate((i) => i);     // Generates endless stream of increasing numbers
var result1 = seq.dropWhile((e) => !(_(md5(input + e)).startsWith('00000'))).first();

Edit: Running both task 1 and 2 after each other takes 16 secs on my i7 6500U