Home CPSC 401

Racket Assignment


Due: March 11



The Goldbach conjecture states that every even number greater than two is the sum of two prime numbers. For example:

6 = 3 + 3
12 = 5 + 7
38 = 7 + 31
10000 = 59 + 9941

The conjecture has never been proven, but has shown been shown to hold for every even number greater than two up to at least 4 quintillion.

You will write a program that reads in a number from the user, verifies that it is even and greater than 2, and prints out two prime numbers that sum to the value the user entered.

Example run:

Enter an even value: 91
That number is not even.
Enter an even value: 0
That number is not greater than two.
Enter an even value: 90
The two primes that add to 90 are 7 and 83.

Your program should continue asking for a value until it is given an even number greater than 2.

Using packages from the Racket "Planet" repository is not allowed, but anything included with the Racket standard library is.





Submit your Racket file to Canvas for this assignment.

Copyright © 2024 Ian Finlayson | Licensed under a Attribution-NonCommercial 4.0 International License.