|
| 1 | +# Armstrong Numbers |
| 2 | + |
| 3 | +An [Armstrong number](https://en.wikipedia.org/wiki/Narcissistic_number) is a number that is the sum of its own digits each raised to the power of the number of digits. |
| 4 | + |
| 5 | +For example: |
| 6 | + |
| 7 | +- 9 is an Armstrong number, because `9 = 9^1 = 9` |
| 8 | +- 10 is *not* an Armstrong number, because `10 != 1^2 + 0^2 = 1` |
| 9 | +- 153 is an Armstrong number, because: `153 = 1^3 + 5^3 + 3^3 = 1 + 125 + 27 = 153` |
| 10 | +- 154 is *not* an Armstrong number, because: `154 != 1^3 + 5^3 + 4^3 = 1 + 125 + 64 = 190` |
| 11 | + |
| 12 | +Write some code to determine whether a number is an Armstrong number. |
| 13 | + |
| 14 | + |
| 15 | +## Getting Started |
| 16 | + |
| 17 | +Please refer to the [installation](https://exercism.io/tracks/haskell/installation) |
| 18 | +and [learning](https://exercism.io/tracks/haskell/learning) help pages. |
| 19 | + |
| 20 | +## Running the tests |
| 21 | + |
| 22 | +To run the test suite, execute the following command: |
| 23 | + |
| 24 | +```bash |
| 25 | +stack test |
| 26 | +``` |
| 27 | + |
| 28 | +#### If you get an error message like this... |
| 29 | + |
| 30 | +``` |
| 31 | +No .cabal file found in directory |
| 32 | +``` |
| 33 | + |
| 34 | +You are probably running an old stack version and need |
| 35 | +to upgrade it. |
| 36 | + |
| 37 | +#### Otherwise, if you get an error message like this... |
| 38 | + |
| 39 | +``` |
| 40 | +No compiler found, expected minor version match with... |
| 41 | +Try running "stack setup" to install the correct GHC... |
| 42 | +``` |
| 43 | + |
| 44 | +Just do as it says and it will download and install |
| 45 | +the correct compiler version: |
| 46 | + |
| 47 | +```bash |
| 48 | +stack setup |
| 49 | +``` |
| 50 | + |
| 51 | +## Running *GHCi* |
| 52 | + |
| 53 | +If you want to play with your solution in GHCi, just run the command: |
| 54 | + |
| 55 | +```bash |
| 56 | +stack ghci |
| 57 | +``` |
| 58 | + |
| 59 | +## Feedback, Issues, Pull Requests |
| 60 | + |
| 61 | +The [exercism/haskell](https://github.com/exercism/haskell) repository on |
| 62 | +GitHub is the home for all of the Haskell exercises. |
| 63 | + |
| 64 | +If you have feedback about an exercise, or want to help implementing a new |
| 65 | +one, head over there and create an issue. We'll do our best to help you! |
| 66 | + |
| 67 | +## Source |
| 68 | + |
| 69 | +Wikipedia [https://en.wikipedia.org/wiki/Narcissistic_number](https://en.wikipedia.org/wiki/Narcissistic_number) |
| 70 | + |
| 71 | +## Submitting Incomplete Solutions |
| 72 | +It's possible to submit an incomplete solution so you can see how others have completed the exercise. |
0 commit comments