CS 315 Assignment 2: Recursion and Lists
Due: February 5, 2010.
File:
Cons.java
This assignment may be done in Java or in Lisp.
1.
Write a recursive function
sumsq(int n)
that adds up the squares of the integers from
1
through
n
.
2.
The mathematician Giuseppe Peano (1858 - 1932) showed that all arithmetic operations on natural
numbers (nonnegative integers) could be reduced to a single constant (0) and an operation
successor
,
which is available in Java as
++
(in Lisp,
1+
).
Peano was one of the first to use what we now call symbolic logic. He introduced, for
instance, the use of the symbols `(E x)' to mean `there is an x such that'; and he habitually
wrote out all of his lecture notes in his new symbolism. He was teaching at a military
academy at the time, and his students were so incensed by his formalistic approach to
mathematics that they rebelled (despite his promises to pass them all) and got him fired.
Subsequently he found a more congenial setting at the University of Turin. -- Rudy
Rucker,
Goedel's Incompleteness Theorems
, p. 289.
This
preview
has intentionally blurred sections.
Sign up to view the full version.

This is the end of the preview.
Sign up
to
access the rest of the document.
- Spring '10
- Moore
- Combinatorics, Recursion, Giuseppe Peano
-
Click to edit the document details