Math Decisions

Do at least eight of these problems. Use Repl.it, python 3. Just paste your answer in as a private comment in Google Classroom.

Learning: Telling if a number is multiple of another using remainder (%) or integer quotient (//).

  1. Ask for a number to start with. Ask for an amount to go up by. Print out the first 15 numbers starting with the given start number and then going up by the amount each time. They can all appear on separate lines.

     Start number? 20
     Increase number? 2
     20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58
    
  2. Ask for a number. Print out if it is divisible by 3, and then also if it is divisible by 7.

     What number? 24
     24 is divisible by 3
     24 is not divisible by 7
    
     What number? 21
     21 is divisible by 3
     21 is divisible by 7
    
  3. Ask for a number N. Count how many numbers from 1 up to and including N are divisible by both 3 and 7. (Start by thinking how to print out all of the numbers 1 .. N.

  4. Ask for a number N. Count how many numbers from 1 up to and including N are divisible by 5 and 9 but not 7.

  5. Ask for a number N. Ask for a number M that you are going to avoid. Add up all of the even numbers from 1 up to N that are not multiples of M.

  6. Ask for a number N. Ask for a number P to go up by. Multiply the first 6 numbers starting at N and going up by P. Except skip even numbers. The answer below comes from N=20, P=3, which produces 20(skip) 23 26(skip) 29 32(skip) 35, giving 232935. If all of the numbers are even, give 1 as the answer.

     What is N? 20
     What is P? 3
     Answer: 23345 
    
  7. (Search for right triangles.) Ask for a number H (the hypotenuse). See if you can find any (integer side) right triangles that have that number as the hypotenuse and 8 as one of the legs.

  8. Modify the triangle searcher to ask for one of the sides, so it isn’t always 8.

  9. Harder: Modify the triangle searcher so it tries all of the possibilities for the a side.

  10. Substitute if one of the other problems is too hard. Looking for solutions to xx+bx = c. Ask for three numbers: N, b, and c. Search the integers from 1 to N to see if any work in the equation xx+bx = c. Print out the ones that work

  11. Another possible substitute.. Ask for a number N. Print all of the divisors of N.