JSFiddle - React, Tailwind, and code Playground
by Preachieved
HTML
seed:<input id="seed" type="text" value="1"></input><br/>
depth:<input id="depth" type="number" value="5"></input><br/>
<button onclick="go()">Go</button>
<div id="stdout"></div>
CSS
#stdout{
border: 1px solid black;
}
JavaScript
window.go = function go(){
var num = $("#seed").val();
var out = $("#stdout").html("");
for(var i=0;i<$("#depth").val();i++){
out.html(out.html()+num+"<br/>");
var newnum = "";
var numarr = num.match(/(\d)\1*/img);
for (match in numarr){
newnum += numarr[match].length + numarr[match].substring(0,1);
}
num = newnum;
}
}