Clone and edit this document
Runkit
Runkit
home page
user forum
new notebook
clone notebook
download notebook
support & documentation
log in
sign up
new notebook
help & feedback
clone this notebook
download this notebook
Sign In
Sign Up
largest perfect cube EN word in base 23
node v5.12.0
version:
3.0.0
endpoint
share
tweet
Largest perfect cube that's an English word in base 23, from https://twitter.com/wacnt/status/669304627964153856
var fs = require('fs') var wordListPath = require('word-list') var words = fs.readFileSync(wordListPath, 'utf8').split('\n') var answer = words .map(word => ({word, root: Math.cbrt(parseInt(word, 23))})) .filter(item => Math.pow(item.root, 3).toString(23) === item.word) .filter(item => item.root % 1 === 0) .sort((a, b) => a.root - b.root) .pop(); `${Math.pow(answer.root, 3)} (${answer.word})`
Loading…
no comments
sign in
to comment