

To compute the Tukey or Dunnett test, divide the difference between the means you are comparing with the standard error of the difference and call the quotient q.
The critical values of q for Tukey multiple comparisons is explained in reference 2. C code can be found here. The critical values of q for Dunnett's test are calculated according to methods explained in reference 3 and an appendix in reference 4.
It is critical in all cases to use the correct number of degrees of freedom, which is the df that corresponds with the mean square value used.
Prism uses the single step (1955) Dunnett test, not the newer (1990s) step up or step down methods.
1. Scott E. Maxwell, Harold D. Delaney, Designing Experiments and Analyzing Data: A Model Comparison Perspective, Second Edition,IBSN:0805837183
2. Margaret Diponzio, Copenhaver, and Burt Holland. Computation of the distribution of the maximum studentized range statistic with application to multiple significance testing of simple effects. Journal of Statistical Computation and Simulation, 15635163, Volume 30, Issue 1, 1988, Pages 1 – 15
3. K.S. Kwong and W. Liu. Calculation of critical values for Dunnett and Tamhane's stepup multiple test procedure. Statistics and Probability Letters, Volume 49, Number 4, 1 October 2000 , pp. 411416(6)
4. J. Hsu, Multiple Comparisons, Theory and Methods. ISBN: 0412982811.