## Introduction

This page has a selection of tasks that you could complete with Haskell. This is a selection of some of the simpler tasks that I worked on when learning Haskell and they are drawn from lots of sources.

## Challenges

1. Write a factorial function.
2. Write a function to return the sum of the squares from 1 to n.
3. Write functions for the nPr and nCr formulas.
4. Write a function to determine if a number is prime. Use trial division.
5. Determine whether a list is a palindrome. A palindromic list would be the same when reversed.
6. Write a function to determine if a number is a square number.
7. List the 5 digit numbers which are palindromic. There are several different ways to do this. Copy the toDigits function used in some of the examples. Remember that 5 digit numbers are in a predcitable numeric range and so don't need to be tested for by counting digits. Try this one using the filter function and then rerwrite it using a list comprehension.
8. Write a function to solve quadratic equations. The function should determine whether or not the equation has real roots.
9. Write functions to calculate the areas of shapes like triangles and quadrilaterals.
10. Write a function to duplicate all of the elements in a list.

11. Modify your duplicating function so that it can replicate items in a list a given number of times.

12. Remove or drop every nth element from a list.

13. Write a function to split a list into a list of a two lists at a given point.

14. Remove the nth element from a list. Return a tuple consisting of the removed item and the list that remains.

15. Write a function that takes a list and returns the unique elements in that list.
16. Write a program that makes an infinite list of abundant numbers. Abundant numbers are smaller than the sum of their proper divisors.
17. Write a program that makes an infinite list of deficient numbers. Deficient numbers are larger than the sum of their proper divisors.
18. Two integers a and b are said to be amicable numbers if the sum of the proper divisors of a is equal to b and the sum of the proper divisors of b is equal to a. Write a program to produce an infinite list of amicable numbers.

19. An evil number is a non-negative integer that has an even number of 1s when represented in binary. An odious number has an odd number of 1s in its binary representation. Write two independently defined functions to produce infinite lists of evil and odious numbers.

20. Pronic numbers are integers which are the product of two consecutive integers. Write a function to produce an infinite list of pronic numbers.

21. Harshad numbers are integers which are divisible by the sum of their digits when written in a particular base. Write code to produce an infinite list of base 10 Harshad numbers.

22. Semi-perfect numbers are integers which are equal to the sum of all or some of its proper divisors. Have a look at the example with practical numbers for a way into this problem. Write code to produce an infinite list of semi-perfect numbers.

23. Write a function that converts an integer from base 10 to any number base from 2 to 10.
24. Determine all three-digit numbers N having the property that N is divisible by 11, and N/11 is equal to the sum of the squares of the digits of N. This was the first of three challenges in the 1960 International Mathematical Olympiad.
25. Look up the various methods for determining the week day for a given date. You should be able to find several methods. Convert as many as you can into Haskell functions.
26. Write a function that accepts a string and returns that string with the word 'banana' inserted between all of the words of the given string.

27. Write a function to convert an integer into words. Choose the range of numbers you are prepared to work with.