geonnave / primg

Generate prime numbers whose binary representation looks like any image.

Home Page:https://geonnave.github.io/primg/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

primg

Inspired by this: Does there exist a prime number whose representation on a phone screen looks like a giraffe?

screenshot

Access it here https://geonnave.github.io/primg/.

Primg has made it to Hacker News' front page! :)

Note: intentionally self-contained; vanilla Javascript by design.

Update: now you can share URLs by appending the decimal number after the hash on the URL (you lose the image tough). For example, this is a prime dog: https://geonnave.github.io/primg/#179769313486231590772930519078902473361797697894230657273429661642538456588077306078196596037783249291026990862829670919205888565609581869739105202524725614169647793002230079727461396703734603105685474079081886809070115786113168328330817484522518138348888081075292599304124949646601273927687076353436639295493. Thanks for jchavannes and fovc from Hacker News for sharing ideas on this feature.

ToDo

  • find a way to update the DOM while doing heavy processing solved: Web Workers to the rescue
  • use a more clever way (maybe histograms stuff) to find the threshold number now using average of image
  • make it faster (currently takes minutes) "solved" by reducing canvas size from 50x50 to 32x32
  • make it prettier

About

Generate prime numbers whose binary representation looks like any image.

https://geonnave.github.io/primg/

License:MIT License


Languages

Language:HTML 92.3%Language:CSS 6.1%Language:JavaScript 1.6%