I'm trying to generate simple Row-Column headings for the Josephus survivor problem, but I can't get the column heading "Survivor" to display. As far as I can tell, I'm dong what is required from the documentation and I suspect I'm doing something trivially wrong but I just can't see it.
I got a workaround by using Grid
, Table
and then prepending a {"","Survivor"}
pair, but it's hardly elegant.
survivor[n_] := Range[n] //. {a_, b_, z___} -> {z, a} // First
survivor /@ Range[5] //
TableForm[#, TableHeadings -> {Range[5], {"Survivor"}}] &
(*
1|1
2|1
3|3
4|1
5|3
*)