Advertisement
nikolayneykov

Untitled

May 28th, 2019
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const getGets = arr => {
  2.   let index = 0
  3.  
  4.   return () => {
  5.     const toReturn = arr[index]
  6.     index += 1
  7.     return toReturn
  8.   }
  9. }
  10. // this is the test
  11. const test = ['18446744073709551615']
  12.  
  13. const gets = this.gets || getGets(test)
  14. const print = this.print || console.log
  15.  
  16. let digits = []
  17.  
  18. for (let i = 65; i <= 90; i++) {
  19.   digits.push(String.fromCharCode(i))
  20. }
  21.  
  22. for (let i = 97; i <= 122; i++) {
  23.   for (let j = 65; j <= 90; j++) {
  24.     digits.push(String.fromCharCode(i) + String.fromCharCode(j))
  25.   }
  26. }
  27.  
  28. let n = BigInt(gets())
  29. let divider = BigInt(256)
  30. let result = []
  31.  
  32. do {
  33.   result.unshift(digits[n % divider])
  34.   n = ~~(n / divider)
  35. } while (n > 0)
  36.  
  37. print(result.join(''))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement