Skip to content

Latest commit

 

History

History
43 lines (33 loc) · 1.46 KB

README.adoc

File metadata and controls

43 lines (33 loc) · 1.46 KB

Project Euler Solutions

NPM
Standard

Travis build status bithound ES2015 semantic-release

Yet another Euler - this time in Javascript

Features all 2016 Javascript/ Node.js buzzwords:

  • ES2015 (formerly ES6)

  • functional

  • immutable data

  • lazy sequences

Solved so far:

  • #1 (3 lines)

  • #16 (5 lines)

  • #19 (5 lines)

  • #20 (3 + 5 lines)

  • #48 (8 lines)

  • #92 (4 + 7 lines)

Alternative implementations

Euler #92

// :: Number -> Number
// Slow: takes about 90 seconds on a 2013 MacBook Pro
const euler92_ = (n) => I.Range(1, n)
  .map((n) => I.Seq(squareDigitChain(n)).last())
  // 10 % faster, but mutation going on:
  // .map((n) => [...squareDigitChain(n)].pop())
  .filter((n) => n === 89)
  .count()