Concise way to draw this pyramid
n = 5;
Graphics3D[Table[Cuboid[{#[[1]], #[[2]], -i}] & /@ Tuples[Range[-i/2, i/2], 2],
{i, 0, n - 1}]]
A more concise version (thanks: Vitaliy Kaurov):
Graphics3D[Table[Cuboid[{#, #2, -i}] & @@@ Tuples[Range[-i/2, i/2], 2], {i, 0, n - 1}]]
Inspired by @kglr, now I got another simpler way
Graphics3D[Table[Cuboid[{x,y,-z}],{z,0,4},{y,-z/2,z/2},{x,-z/2,z/2}]]
or
Graphics3D[Table[{Cuboid[{x-z/2,y-z/2,-z}]},{z,5},{y,z},{x,z}]]
Not concise
n = 7;
Standardize[GraphEmbedding@GridGraph@#, Mean, 1&] & /@ Array[{#,#}&, n] //
Cuboid /@ Join@@MapIndexed[Append[#1, - First@#2 +.5]&, #, {2}] & // Graphics3D
but fun to play with:
n = 20;
Standardize[ #(CycleGraph@#~GraphEmbedding~"CircularEmbedding"), Mean, 1&] & /@ Array[#&, n] //
Ball /@ Join@@MapIndexed[Append[#1, - 1.5 First@#2 +.5]&, #, {2}] & // Graphics3D