Look-and-say sequence: Difference between revisions

Content deleted Content added
Line 2,910: Line 2,910:
=={{header|Mathematica}}/{{header|Wolfram Language}}==
=={{header|Mathematica}}/{{header|Wolfram Language}}==
The function:
The function:
<lang Mathematica> LookAndSay[n_Integer?Positive]:= Map[Reverse, Tally/@ Split @ IntegerDigits @ n, 2] // Flatten // FromDigits</lang>
<lang Mathematica> LookAndSay[n_Integer?Positive]:= Map[Reverse, Tally /@ Split @ IntegerDigits @ n, 2] // Flatten // FromDigits</lang>


takes an *arbitrary* positive integer, and generates the next member of the ‘Look and Say’ sequence.
takes an *arbitrary* positive integer, and generates the next member of the ‘Look and Say’ sequence.