Nik333

r/counting bookmarklets non-obfuscated

Jan 21st, 2019
284
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // (c) 2019 NoxZet (aka NikinCZ)
  2. // This code is licensed under MIT license (https://opensource.org/licenses/MIT)
  3.  
  4. javascript: (function() {
  5.     var currentNumber = prompt('Find next "Only Repeating Digits" after:', '')-0;
  6.     while (true) {
  7.         currentNumber += 1;
  8.         currentArray = (currentNumber+"").split("");
  9.         var digitDict = {};
  10.         for (let i in currentArray) {
  11.             digitDict[currentArray[i]-0] = (digitDict[currentArray[i]-0] || 0) + 1;
  12.         }
  13.         var hasNoSingles = true;
  14.         for (let i in digitDict) {
  15.             if (digitDict[i] < 2) {
  16.                 hasNoSingles = false;
  17.                 break;
  18.             }
  19.         }
  20.         if (hasNoSingles) {
  21.             alert(currentNumber + ' is the next "Only Repeating Digits" number');
  22.             break;
  23.         }
  24.     }
  25. })();
  26.  
  27. javascript: (function() {
  28.     var currentNumber = prompt('Find next "420 Counting" after:', '')-0;
  29.     var work = true;
  30.     while (work) {
  31.         currentNumber += 1;
  32.         currentArray = (currentNumber+"").split("");
  33.         var foundString = 0;
  34.         for (let i = 0; i < currentArray.length-2; i++) {
  35.             if (currentArray[i] == "4" && currentArray[i+1] == "2" && currentArray[i+2] == "0") {
  36.                 alert(currentNumber + ' is the next "420 Counting" number');
  37.                 work = false;
  38.                 break;
  39.             }
  40.         }
  41.     }
  42. })();
  43.  
  44. javascript: (function() {
  45.     var currentNumber = prompt('Find next "88 Counting" after:', '')-0;
  46.     var work = true;
  47.     while (work) {
  48.         currentNumber += 1;
  49.         currentArray = (currentNumber+"").split("");
  50.         var foundString = 0;
  51.         for (let i = 0; i < currentArray.length-1; i++) {
  52.             if (currentArray[i] == "8" && currentArray[i+1] == "8") {
  53.                 alert(currentNumber + ' is the next "88 Counting" number');
  54.                 work = false;
  55.                 break;
  56.             }
  57.         }
  58.     }
  59. })();
  60.  
  61. javascript: (function() {
  62.     var currentNumber = prompt('Find next "Only numbers that contain the digits 1 and 4" after:', '')-0;
  63.     while (true) {
  64.         currentNumber += 1;
  65.         currentArray = (currentNumber+"").split("");
  66.         var digitDict = {};
  67.         for (let i in currentArray) {
  68.             digitDict[currentArray[i]-0] = 1;
  69.         }
  70.         if (digitDict[1] == 1 && digitDict[4] == 1) {
  71.             alert(currentNumber + ' is the next "Only numbers that contain the digits 1 and 4" number');
  72.             break;
  73.         }
  74.     }
  75. })();
  76.  
  77. javascript: (function() {
  78.     var currentNumber = prompt('Find next "Only consecutive digits" after:', '')-0;
  79.     while (true) {
  80.         currentNumber += 1;
  81.         currentArray = (currentNumber+"").split("");
  82.         var digitDict = {};
  83.         for (let i in currentArray) {
  84.             digitDict[currentArray[i]-0] = (digitDict[currentArray[i]-0] || 0) + 1;
  85.         }
  86.         var digitArray = Object.keys(digitDict);
  87.         onlyConsecutives = true;
  88.         for (let i in digitArray) {
  89.             if (digitArray[i-0+1] !== undefined && (digitArray[i-0]-0)+1 !== (digitArray[i-0+1]-0)) {
  90.                 onlyConsecutives = false;
  91.             }
  92.         }
  93.         if (onlyConsecutives) {
  94.             alert(currentNumber + ' is the next "Only consecutive digits" number');
  95.             break;
  96.         }
  97.     }
  98. })();
  99.  
  100. javascript: (function() {
  101.     var currentNumber = prompt('Find next "No consecutive digits" after:', '')-0;
  102.     while (true) {
  103.         currentNumber += 1;
  104.         currentArray = (currentNumber+"").split("");
  105.         var digitDict = {};
  106.         for (let i in currentArray) {
  107.             digitDict[currentArray[i]-0] = (digitDict[currentArray[i]-0] || 0) + 1;
  108.         }
  109.         var noConsecutives = true;
  110.         for (let i = 0; i < 9; i++) {
  111.             if (digitDict[i] > 0 && digitDict[i+1] > 0) {
  112.                 noConsecutives = false;
  113.                 break;
  114.             }
  115.         }
  116.         if (noConsecutives) {
  117.             alert(currentNumber + ' is the next "No consecutive digits" number');
  118.             break;
  119.         }
  120.     }
  121. })();
Advertisement
Add Comment
Please, Sign In to add comment