Sequence pictures

Ed Pegg Jr. edp at wolfram.com
Mon Jul 14 09:55:13 CEST 2003


At http://www.mathpuzzle.com/numbersequences.gif , I've turned a
few sequences into pictures.  The first one is the Recaman sequence.

For many sequences, a pictures will fit on a line the size of this
sentence.  For the curious, here is the code.

NiceRasterGraphics[state_, colors_:2, size_:1] :=
With[{dim = Reverse[Dimensions[state]]},
Graphics[Raster[Reverse[1 - state/(colors - 1)]],
AspectRatio -> Automatic,
PlotRange -> {{0, dim[[1]]}, {0, dim[[2]]}},
ImageSize -> size*dim + 1]]

Recaman[n_] := Recaman[n] = Recaman[n - 1] +
n If[Recaman[n - 1] - n > 0 && Position[Table[
Recaman[k], {k, 1, n - 1}], Recaman[n - 1] - n] == {}, -1, 1]

Show[NiceRasterGraphics[Transpose[Table[
IntegerDigits[Recaman[n], 2,14], {n, 1, 512}]]]];

--Ed Pegg Jr, www.mathpuzzle.com, www.wolfram.com

>






More information about the SeqFan mailing list