Perfect Roots

Published by Werdna in

Given a number $n, find if its 2nd, 4th and 8th roots are all integers (perfect roots), return true if it exists, false if not.

Examples

perfectRoots(256) ➞ true
// 2nd root of 256 is 16
// 4th root of 256 is 4
// 8th root of 256 is 2

perfectRoots(1000) ➞ false

perfectRoots(6561) ➞ true

Notes

n > 1

Watch a quick demo on how Edabit works.