The brain performs many kinds of computation for which it is challenging to hypothesize any mechanism that does not contradict the evidence. In particular, over a lifetime the brain performs a large number of individual cognitive, most having some dependence on past experience and also long-term effects. It is difficult to reconcile such large scale capabilities, even in principle, with the known resource constraints on cortex, such as low connectivity and low average synaptic strength. Here we shall describe model neural circuits and associated algorithms that respect the brain's most basic resource constraints and support the execution of large numbers of cognitive actions. These circuits simultaneously support a suite of four basic kinds of task that each requires some circuit modification: memory allocation, association, supervised memorization, and inductive learning of threshold functions. The capacity of these circuits is established via experiments in which sequences of thousands of such actions are simulated by computer, and the circuits created tested for the subsequent efficacy of these actions. Hierarchical memory allocation to arbitrary depth has the added requirement that a stable number of neurons be assigned to memories at every level. We give a mechanism for this that can be realized in a shallow feedforward network. We suggest that in the brain it is the hippocampus that performs this stable memory allocation.