** Next:** Chapter 3.
** Up:** Challenge CS Problems
** Previous:** Chapter 1

- 1.
- The function
*f*(*n*) is defined as follows:
Input a positive integer *N* and print the value of *f*(*N*).
The number *N* may be so large that using an array of *N*
integers is not allowed (as well as an array whose length
grows with *N*).
- 2.
- Find the first positive integer
*N* such that it can be
written as a sum of squares of four integers (i.e.
*N* = *k*^{2} + *l*^{2} + *m*^{2} + *n*^{2} for some integers *k*,*l*,*m*,*n*)
*in more than one way*.
- 3.
- Input a positive inetger
*n* and fill a two-dimensional
array *A*[*n*][*n*] with numbers so that they
form a spiral (see Fig. 1).
- 4.
- Print out all four digit positive integers whose digits
are all different. Generalize this problem for numbers with
*n* digits.
- 5.
- Given a number
*N* and an integer array *A*[*N*] of length *N*.
Write a function that finds the the length of the longest sequence
of zeros in the array.

*Sergey Bratus*

*12/8/1997*