Skip to main content
added 39 characters in body
Source Link
RunnyKine
  • 33.3k
  • 3
  • 110
  • 176

Here's an approach without If or For. First somea helper functionsfunction:

f[x_](* :=Thanks mrowto Belisarius for the mrow& suggestion *)
 g[x_] := NestWhile[fNestWhile[mrow&, x, MemberQ[x - #, 0] &] 

Then:

NestList[g, mrow, 9] // MatrixPlot

Where mrow is as you've defined it in the question.

Mathematica graphics

Here's an approach without If or For. First some helper functions:

f[x_] := mrow
g[x_] := NestWhile[f, x, MemberQ[x - #, 0] &]

Then:

NestList[g, mrow, 9] // MatrixPlot

Where mrow is as you've defined it in the question.

Mathematica graphics

Here's an approach without If or For. First a helper function:

(* Thanks to Belisarius for the mrow& suggestion *)
 g[x_] := NestWhile[mrow&, x, MemberQ[x - #, 0] &] 

Then:

NestList[g, mrow, 9] // MatrixPlot

Where mrow is as you've defined it in the question.

Mathematica graphics

Source Link
RunnyKine
  • 33.3k
  • 3
  • 110
  • 176

Here's an approach without If or For. First some helper functions:

f[x_] := mrow
g[x_] := NestWhile[f, x, MemberQ[x - #, 0] &]

Then:

NestList[g, mrow, 9] // MatrixPlot

Where mrow is as you've defined it in the question.

Mathematica graphics