Anonymous user
Look-and-say sequence: Difference between revisions
m
→{{header|Mathematica}}/{{header|Wolfram Language}}
Line 2,912:
<lang Mathematica> LookAndSay[n_Integer?Positive]:= Map[Reverse, Tally /@ Split @ IntegerDigits @ n, 2] // Flatten // FromDigits</lang>
takes as input an <em>arbitrary</em> positive integer
The first example returns the next 12 numbers of the sequence starting with 1:
|