DEV Community

Discussion on: Daily Challenge #55 - Building a Pile of Cubes

Collapse
 
dominikfg profile image
Dominik G • Edited

Ok, now I got a solution thanks to Wolfram Alpha:

const f = m => {
  var n = (Math.sqrt(8 * Math.sqrt(m) + 1) - 1) / 2;
  return n === Math.floor(n) ? n : 0;
};