Gets the name of a number, even if it's stupidly big. Supersedes TheoryOfNekomata/number-name.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

18 regels
458 B

  1. const { default: getNumberName } = require('../packages/core')
  2. const fs = require('fs')
  3. const path = require('path')
  4. const main = async () => {
  5. const ws = fs.createWriteStream(path.resolve(__dirname, 'count-to-one-milliatillion.out.csv'))
  6. ws.write('number,name\n')
  7. for (let i = 0; i <= 3000003; i++) {
  8. if (i % 1000 === 0) {
  9. console.log(i)
  10. }
  11. ws.write(`1e+${i}` + ',' + getNumberName(`1e+${i}`) + '\n')
  12. }
  13. ws.close()
  14. }
  15. void main()