Skip to content
/ primg Public

Generate prime numbers whose binary representation looks like any image.

License

Notifications You must be signed in to change notification settings

geonnave/primg

Repository files navigation

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.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published