πΎ Archived View for blitter.com βΊ apl-examples βΊ armstrong-numbers βΊ armstrong-numbers-example.apl.tβ¦ captured on 2023-05-24 at 17:49:19.
-=-=-=-=-=-=-
#!/usr/bin/env apl --script ββ Determine if a number _n_ is an Armstrong number βex 'digitsOf' βr β digitsOf n;digitList digitList β β¬ loop:β((βn)=0)/done digitList β digitList,(βn|β¨10) n β nΓ·10 βloop done: r β βdigitList β βex 'isArmstrongNumber' βr β isArmstrongNumber n;digits;nd digits β digitsOf n nd β β’ digits r β n = +/digits * nd β β isArmstrongNumber 9 β1 β isArmstrongNumber 10 β0 β isArmstrongNumber 153 β1