What is the purpose of the Arduino setup() and loop() functions?

Great question. The SETUP() function is the first thing the Arduino will call when it is powered up. Everything in this area will run once and only once. This is the best place to initialize all your input and output pins. You could even set your integers in your SETUP() function. The LOOP() function does exactly what it is named. It loops your code that you have written repeatedly unless you have put a stop command in it or remove power from the Arduino. This is where the bulk of your coding will be. The coding will be whatever you want your Arduino to accomplish.