This program can convert an arbitrary image into a prime. Given an image, it will generate a base-ten number with the same amount of digits as the image has pixels with 9 representing black and 0 representing white. This can be converted back into a greyscale image.
- Open
primify.nbwith Mathematica - Replace the placeholder picture of a computer with your desired image (copy-paste or drag-and-drop). See Image Considerations for optimal formatting.
- Run the preprocessing cells.
- Run the
Parallel Searchcell. Eventually, this will output a number. When it does, abort the cell (Evaluation -> Abort Evaluation). - Copy this number into the
myPrime =cell. - Run the following cells to ensure your image is indeed a prime, and to see how it looks.
The search takes about 20-30 minutes for a 109x109 pixel image on my i7-12650H.
- Your image will be converted into grayscale image
- It is recommended that the dimensions of your image be SomePrime x SomePossiblyDifferentPrime. This way, when converting your number into an array of pixels, there is only one reasonable way to do so. Of course, this is purely stylistic; the program will work irrespective of which dimensions are chosen.
- The author has specifically tested 109x109 and 131x97 images. The program generated a prime in approximately 20-40 minutes.
Gets converted into
With the corresponding prime:
9110111111111111111111111111111111111001111011111011111011101101110011111110111111011111111111111111111111110111111110110011111111111111111111111011111111111101111111111011011111101111111111111011111111111111111111111111101111111111100101111111111111111111011111111011101111111011111101111010101111111011111111111111111111111111111111111011111111111111111111111111101111111111111111111111111111011111111111110011111111111111111111111111111111111111101011101111111111111111101111111111110111101111011011111111111111111110111111111111111111111111111111111100111111111111011111111111111111111111111111111111111111111111110111111111011110101111111111111110111111111111111111111111111111111111111111111111111111101111111111111111111111011111110111111111111110111101111111111111111111111111111111111111111111110111111111111111111111111101111111111111111110111111111111111111101111111111111111111111111101111111111111111111111111111111111111011111110111111111111111111111111111111110111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111101111111111111111111011111111101111111111111111111111111111111111111111111111111111111111111111101111111111111111011111111111111111111111111111111111111111111111111111111111111111110101111111111111111111111111111111111111110111111111111111111111111111111111111111111111111111111111111111111111111111101111111111111111111111111111111111111111111111101111111111111111111111111111111111111111111111111101111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111110111101111012221222112122222222222232222223323322333333333333433333433344444444444444431111111111111111111111111111111147888888888888889888888888888888888888888888888888888888888888888888888888877611110111111101101111111111111137878788888888888888788888888888878788887888888888888888888888888888898888888872111111111111111111111111111114888888887888888888887888888888888888888888888888888888888888888888888888888888211111111111111111111111111111488888888788888888888888888888888888888888888888888888888888888888888888888888821111111111111111111111111111147887888888888888888888888888888888888888888888888888888888888888888888888888882111111111111111111111111111113788888888888888888888888888888888888888888888888888888888888888888888888888878211111111111111111111111111111478888888888888888888888888888888888888888888888888888888898888888888888888888721111111111111011111111111111147888888888888888888888888888888888888888888888888888888888888888888888888888882111111111111111111111111111114878888888888888888888888888888888888888888888888888888888888888888888888888888211111111111111111111111111111478888888888888888888888888888888888888888888888888888888888888888888888888888721111111111111111111111111011147888878888888888888888888888888888888888888888888888888888888888888888888888882111111111111111111111111111114888888888888888888888888888888888888888888888888888888888888888888888888888888311111111111111111111111111111488888888888888888888888888888888888888888888888888888888888888888888888888888731111111111111111111111111111148888888888888888888888888888888888888888888888888888888888888888888788888888883111111111011111111111111111115888888888888888888888888888888888888888888888888888888888888888888888888888878311111111111111111111111111111588888888888888888888888888888888888888888888888888888888888888888888888888887831111111111111111111111111111158888888888888888888888888888888888888888888888888888888888888888888888888888783111111111111111112111111111115888888888888888888888888888888888888888888888888888888888888888888888888888887311111111111111111111111111111578888888888888888888888888888888888888888888888887888888888888888888888888887741111111111111111111111111111158888888888888888888888888888888888888888888888888888888888888888888888888887874111111111111111111111111111116888888888888888888888888888888888888888888888888888888888888888888888888888888411111111111111111111111111111588888888888888888888888888888888888888888888888888888888888888888888888888887841111111111111111111211111111168888888888888888888888888888888888888888888888888888888888888888888888888888874111111111111111111222211111115888888887888888888888888888888888888888888888888888888888888888888888888888887411111111111111111122211211111688888888888888888888888888888888888888888888888888888888888888888888888888888851111111111111111122222111111158888888888888888888888888888888888888888878888888888888888888888888888888888875111111111111111112221211121116888888888888888888888888888888888888888888888888888888888888888888888888888878511111111111111111222222112211687888888888888888888888888888888888888888888888888888888888888888888888888888851111111111111111122222111111168888888888888888888888888888888888888888888888888888888888888888888888888888785111111111111111112222112111126888888887888888888888888888888888888888888888888888889888888888888888888888888511111111111111111222221222111688888888888888888878888888888888888888888888888888888888888888888888888888887851111111111111111122212222212168888888888888888888888888888888888888888888888888888888888888888888888888888876111111111111111113222221221116878888888888888888888888888888888888888889888888888888888888888889888988888888611111111121111111222222212221678888888888888888888888888888888888888888888888888888888888888888888888888888861111121121111111133222222221167888888888888888888888888888888888888888888888888888888888888888888888888888886111112111111112112322322122216888888888888889888988888888888888888888888888888888888888888888888888888888888711111111111212111332222222222788888888888888888888888888888888888888888888888888888888888888888888888888888861121111112211121133332322222178888888888888888888888888888888888888888888888888888888888888888888888888888887111111122111111213332322222227888888878888888888888888888888887888888888888888888888888888888888888888888888612111111211112121333333223222788888888888888888888888888888888888888888888788888888888888888888888888888888871221221221212222243333332222277888888888888888888888888888888888888888888888888888888888888888888888888888887112222222122222224433333323227788888888888888888888888888888888888888888888888888888888888888888888888888888712222122222222222544333433332788888888888888888888888888888888888888888888888888888888888888888888888888888872222222222222222244344434333278888888888888988888888888888888888888888888888888888888888888888888888888888887122222222222222223322333322227888888888888888888888888888888888888888888888888888888887888888888888888888888722222222222222222222222222222788888888888888888888888888888888888888888888888888888878888888888888888888888772222322322322333222222222222288888888888888888888888888888888888888888888888888888888888888888888888888888888122332322332232332222222221227888888888788888888888888888888888888888888888888888888888888888888888888888887722222232233333333212222211212887888888888888888888888888888888888888888888888887888888888888888888888888887881222222222232222321221222122288888888888888888888988888888888888888888888888888888888888888888788888888888888222222222221112222222222222227788888888888888888888888888888888888888888888888888888888888888888888887988888822212221211221221122222222222788878887887888888888888888888788888888888888888877888878878888888878878878787782212111111111111122222222222377767777777877877877777777778777777777777777777777777777777777777777777766777777211111111111111212222222222323333333355565555555555555555555455555555645555555555555555555565555555553223323212111121111211111222322222222333343423333233222323233232333222322322222221232223221222212222232222222222222221212111121112111122122122222223333333587748785677747675577657775587656775577666866578675866577675878532222222211111211111221111221122222222323233378876878586866768586856767586858777686857777686858886687858777774222222222111111211111211122222222222222323347788865768585766868486856878487755868487865868487765878487865878432222221211111111111111112122222322223223235788887567774877558674868658774777648775777748775687747775587787743222222222111111111111111222222332222222223777788868667685867668685766767686675858576676857668575866658887787322222111221111111121111222222232222223223487878888757877487856878587775868567685876748784688848786488888876742222122111121111112212222222232222222322357884777857786577775688888888888888888788864778764887423332778724433322222222211111212222122222233222222222324555444543555445555355555554555555555555555455555455544555455663656532222222121111112221222222223322222222322332333323322233222322222222222222222222222222222222222222222333222222222222222211111111111122222322222222232222323233332222222222223333333333333333233332323222222222222322232232222212222212111222222222223232222222222232222322223332322222223333343333433333433333333332222222222222232222222222121222211111121211222232222222222222233222322322222222223333333343344443433334333333222222222222222222222222212222111111111111122333222222222222223233223232232322222333334443333334333333333333322222222222222222222222222112211111111111112223322112222222322222232222222222222223333343333343333333333333332222222222222222222222222221221111111112111222332122222222222223322222222222222222333333333333333333333333333222222222322322222222222212221122122222222133222112222222222222222222222222222222222222222222222222223222222222222222222222222222222222212112111121221212233212111111211222222211222122222222221112121111211111111212122222122222222222222222222212212212211111211111223322110111111001101111111111011011001110111010001100000111111111111011111111111111111111111111111011111111222233433333333333333323333322332222222222222222222212222222222222222222122222221222122221212221221111111111112223445666666677677777777766766676676767777777766777777777777776777767777777777777776667767777664432111111111222222232322232323323333233323332222222222223222323332223332333333333233333233333333333343333333332212111111122222222221222222221122221211111111111111111112211111111111111111111121111111111111111111121211121221111121112222222222221221121221111211111111122111111111111111111111111111112111111111111111111111111212111211112111112222211222121222211111121121111111111111111112112111111111111111111111111111111111111111111111111111112111111112222212211222222221222211111111111221111111111111211111111111111111111111111111111111111111111122111111121112222222222222212222222222222212212212121111211122111111111111121111121111121121111121111212221122122222222221222222222222222222121121122222221212111212122222222221121212112222222222212222222222222222222223222222222223222111222212222222212112222212122222221222121222122122122222222121212222222222222222222222222222222222222223222211222222212222222222111221222222211122122221121212221211122211222221222212222212122212222222222223222223222332222323222222222222222223222222222222222222222232232223222233222333222232223223222333333323333333333333333332333333332333233333333333333333343333333333334333345333333334444434344434344343444444344444444444555444544552222222222222222222222222222222222222222222222222223521121111222222222222222222222222222222222232233322232233222222222222222222222222222222222222222222212222221351222112222222222222221222222222222222222222222332232323312222222222222222222222221222212222222222222222222235211112222222222222222222222222222222222222222222232232232222222222222222222222222222221222212222222221122223421111221222222222222222222222222222122222222222232232333222222212222222222212212221212122222222222222222222351211221222221222222221221122222222222222222222223323333322222222222222222222222222222222222222222222222222235111111121222222221222222222222222222222222223333333333332222222222222222222222222222222222212222122222222223521112222222212222212222221222222222222222222333333333339

