Skip to content

Instantly share code, notes, and snippets.

@KrishnaPravin
Last active October 13, 2023 06:46
Show Gist options
  • Save KrishnaPravin/bb02a18bcc07738bf6dd08c4b0fec161 to your computer and use it in GitHub Desktop.
Save KrishnaPravin/bb02a18bcc07738bf6dd08c4b0fec161 to your computer and use it in GitHub Desktop.

Revisions

  1. KrishnaPravin revised this gist Oct 13, 2023. 1 changed file with 29 additions and 1 deletion.
    30 changes: 29 additions & 1 deletion gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -1 +1,29 @@
    function krs() {}
    const letters = {
    'A': 1,
    'T': 4,
    'M': 4,
    'N': 5,
    }
    // tn = 9, 42 = 6, am = 5
    // tn42am = 2

    const ns0 = [1,3,5,6,9,10,14,15,16,18,21,24,27,32,33,36,42,46,50,51]
    const ns1 = [19,23,37,41,45]
    const ns2 = [20,52,55]

    function reduce(numStr) {
    const n = numStr.split('').reduce((acc,c) => acc += Number(letters[c] || c), 0)
    return n < 58 ? n : reduce(n.toString())
    }

    let n = 3900, k = [], j = [], l = [];
    while(n <= 4900) {
    const str = 'TN42AM' + n
    const r = reduce(str)
    ns1.includes(r) && k.push([str, r, 'ns1'].join('-'));
    ns0.includes(r) && j.push([str, r, 'ns0'].join('-'));
    ns2.includes(r) && l.push([str, r, 'ns2'].join('-'));
    n++;
    }

    console.log(k, j, l)
  2. KrishnaPravin created this gist Oct 13, 2023.
    1 change: 1 addition & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    function krs() {}