VI: The Programmatic Side of Mathematica: The perfect shuffle of a deck of cards

Making a deck of cards requires making a the basic thirteen card values: Join[Range[2,10], {J, Q, K, A}] {2,3,4,5,6,7,8,9,10,J,Q,K,A} Then, you need to distribute these values among the four suits: Outer[List, {c, d, h, s}, %] {{{c,2},{c,3},{c,4},{c,5},{c,6},{c,7},{c,8},{c,9},{c,10},{c,J},{c,Q},{c,K},{c,    A}},{{d,2},{d,3},{d,4},{d,5},{d,6},{d,7},{d,8},{d,9},{d,10},{d,J},{d,    Continue Reading

The Programmatic Side of Mathematica IV: Functions Associated with Pascal’s Triangle

The nth triangular number can be written as a function: triangular[n_] := Sum[i, {i, 1, n}] What about a series of such numbers? You may sequentialize triangular[n] and make it return an array: Table[triangular[n], {n, 1, 100}] But it’s better Continue Reading