Philosophical aside #1: Operations on lists

When coding in Mathematica, it is often helpful to think of programs as series of functional operations performed on lists, lists of lists, and so on. To program effectively using this metaphor, it is important to be familiar with the many functions that Mathematica makes available for operating on lists. Section 1.8 of the Mathematica Book (also available in the on-line help browser) provides a thorough introduction to lists and operations on lists. If you haven't done so already, read it.

Exercises

1. Create a list of all primes between 100 and 1000.
3. Let x={a,b,c,d,....}. Write a function g such that g[x]=a×b×c×d...
4. Write a function h such that h[n] is a list of all multiples of n between 0 and 1000.
5. Write a function i such that i[n] is the number of elements in h[n].
5. Create a list of lists of all primes between 1 and 10, 10 and 100, 100 and 1000, etc.
6. Let x={a,b,c,d,....}. Write a function f such that f[x]={Log[a], Log[b], Log[c], ...}


Converted by Mathematica      November 5, 1999