Skip to content

Instantly share code, notes, and snippets.

@lightsuner
Last active August 29, 2015 13:57
Show Gist options
  • Save lightsuner/9651747 to your computer and use it in GitHub Desktop.
Save lightsuner/9651747 to your computer and use it in GitHub Desktop.
<script src="//code.jquery.com/jquery-2.1.0.min.js"></script>
Result: <div id="result"></div>
<script>
function hasAllPatterns(string) {
var requiredDigits = [
0,
1,2,3,4,5,6,7,8,9,
'a', 'b', 'c', 'd', 'e'
];
for (var i=0; i< requiredDigits.length; i++) {
if (string.indexOf(requiredDigits[i]) == -1) {
return false;
}
}
return true;
}
var num = 2,
multiplier = 0,
stop = false,
res = 0,
strNum,
base = 15,
$result = $('#result')
;
while (!stop) {
res = Math.pow(num, multiplier)
strNum = res.toString(base);
$result.html(strNum);
if (hasAllPatterns(strNum)) {
stop = true;
$result.append('<br>Multiplier: '+multiplier);
return;
}
multiplier++;
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment