#!/usr/bin/env bash

number="$1"

# Convert number to string to get the number of digits
num_str="${number}"
num_digits="${#num_str}"

sum=0
for (( i=0; i<${num_digits}; i++ )); do
    # Extract the i-th digit from the number
    digit="${num_str:$i:1}"
    sum=$((sum + digit ** num_digits))
done

if (( sum == number )); then
    echo "true"
else
    echo "false"
fi