Determining classically whether a coin is fair (head on one side, tail on the other) or fake (heads or tails on both sides) requires an examination of each side. However, the analogous quantum procedure (the Deutsch-Jozsa algorithm) requires just one examination step. The Deutsch-Jozsa algorithm has been realized experimentally using bulk nuclear magnetic resonance techniques, employing nuclear spins as quantum bits (qubits). In contrast, the ion trap processor utilises motional and electronic quantum states of individual atoms as qubits, and in principle is easier to scale to many qubits. Experimental advances in the latter area include the realization of a two-qubit quantum gate, the entanglement of four ions, quantum state engineering and entanglement-enhanced phase estimation. Here we exploit techniques developed for nuclear magnetic resonance to implement the Deutsch-Jozsa algorithm on an ion-trap quantum processor, using as qubits the electronic and motional states of a single calcium ion. Our ion-based implementation of a full quantum algorithm serves to demonstrate experimental procedures with the quality and precision required for complex computations, confirming the potential of trapped ions for quantum computation.