// Generic Root of a number = sum of all the digits of the number until we get a single-digit
// 12345 : 1 + 2 + 3 + 4 + 5 = 15 : 1 + 5 = 6
// Generic Root of 12345 is 6
$num = 12345;
while($num > 10) {
$sum = 0;
echo "sum digits of " . $num . " = ";
while($num) {
$remainder = $num % 10;
$num = $num / 10;
$sum += $remainder;
}
echo $sum . "\n";
if($sum > 10)
$num = $sum;
else
break;
}
echo "generic root = " . $sum;
/*
run:
sum digits of 12345 = 15
sum digits of 15 = 6
generic root = 6
*/