Jump to content

Look-and-say sequence: Difference between revisions

Line 2,910:
=={{header|Mathematica}}/{{header|Wolfram Language}}==
The function:
<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 and generates the next member of the ‘Look and Say’ sequence.
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.