TheAlgorithms-PHP/Maths/NeonNumber.php
2022-10-11 17:16:44 +05:00

13 lines
271 B
PHP

<?php
function isNumberNeon($input)
{
$inputSquare = $input * $input;
$inputArr = array_map('intval', str_split($inputSquare));
$sumOfSquareDigits =0;
foreach ($inputArr as $digit) {
$sumOfSquareDigits +=$digit;
}
return $sumOfSquareDigits ==$input;
}
?>