Skip to main content
included manatwork's suggestions
Source Link
user unknown
  • 4.6k
  • 31
  • 31

Bash, 7464 chars

a=$1;p=${#a};forfor((;a>0;aa=$1;a>0;s+=(a%10)**${#1},a/=10));do s=$((s+(a%10)**p));done;echo:; $((s==$1))done;echo $[s==$1]
a=$1;p=${#a};for((;a>0;a/=10));do s=$((s+(a%10)**p));done;echo $((s==$1))

Bash, 74 chars

a=$1;p=${#a};for((;a>0;a/=10));do s=$((s+(a%10)**p));done;echo $((s==$1))

Bash, 64 chars

for((a=$1;a>0;s+=(a%10)**${#1},a/=10));do :; done;echo $[s==$1]
a=$1;p=${#a};for((;a>0;a/=10));do s=$((s+(a%10)**p));done;echo $((s==$1))
Source Link
user unknown
  • 4.6k
  • 31
  • 31

Bash, 74 chars

a=$1;p=${#a};for((;a>0;a/=10));do s=$((s+(a%10)**p));done;echo $((s==$1))