From the literature, showed below, I know two gadgets that provide a way to know if a positive integer (a positive quantity of units) is composite or a prime number. I would like to know if in the literature or from your invention it is possible to show other different gadgets that provide us primality tests.

Question. Do you know different gadgets or mechanisms from the literature that can be used as a primality test? Then, please add the references asnwering my question as a reference request and I try to read it from the literature. Are you able to provide a different gadget from your invention that provide (its idealization as a physical machine) a way to determine if a quantity (of something) is prime or composite? Many thanks.

Feel free to provide draws of your machine as companion of your explanation of how and why works it as a primality test.


[1] A. K. Dewdney, On the spaghetti computer and other analog gadgets for problem solving, Scientific American Volume 250  Issue 6 (June 1984), Computer Recreations p. 19-26.

[2] Francisco Javier Díaz Aspe, Cómo detectar primos usando una cuerda con nudos, Miniaturas matemáticas de La Gaceta de la RSME, La Gaceta de la Real Sociedad Matemática Española, Núm. 1, Pág. 80 Vol. 22 (2019).

  • 6
    $\begingroup$ Does a computer count as a gadget? $\endgroup$ Nov 28, 2019 at 11:26
  • $\begingroup$ I think we shouldn't accept it as a gadget @GerryMyerson if you mean a modern computer. On the other hand if there are simple and primitive machines that computes/checks if an integer is prime, these can be an example from my point of view. My idea are similar and simple gadgets than [1] or [2]. $\endgroup$
    – user142929
    Nov 28, 2019 at 12:50
  • $\begingroup$ All users, after six months that was posted the answer I've decided accept it as an excellent answer. I think that this post will be useful for all those who want to know references for gadgets as primality tests, many thanks all. $\endgroup$
    – user142929
    May 6, 2020 at 13:20

1 Answer 1


I interpret a "gadget" as a physical device that operates in an analog, rather than a digital way (to exclude a computer). The OP asks for "primality tests", but if I may broaden the question to include "prime number generators", there is a variety of such gadgets, collected at unusual and physical methods for finding prime numbers.

The gadgets use effects from chemistry (Biochemical identification of prime numbers), biology ( A Biological Generator of Prime Numbers, and physics An optical Eratosthenes' sieve for large prime numbers.

The latter would qualify as a primality test, I cite the abstract and show a figure from that paper:

We report the first experimental demonstration of prime number sieve via linear optics. The prime numbers distribution is encoded in the intensity zeros of the far field produced by a spatial light modulator hologram, which comprises a set of diffraction gratings whose periods correspond to all prime numbers below 149. To overcome the limited far field illumination window and the discretization error introduced by the finite spatial resolution, we rely on additional diffraction gratings and sequential recordings of the far field. This strategy allows us to optically sieve all prime numbers below $149^2 = 22201$.

  • $\begingroup$ Many thanks for your answer. $\endgroup$
    – user142929
    Nov 30, 2019 at 12:57
  • $\begingroup$ I would like, with your permission, to add as a side comment an experiment that I know with title Feedback by Ian Stewart, a small extract after his column Mathematical Recreations from Volume 277 Number 6 (December 1997), from Scientific American. It is concerning an article due to Mels Sluyser and Erik L. L. Sonnhammer, Molecular Biology and Futuristic Problem Solving (edited by Clifford A. Pickover, Science Reviews, Northwood, England, 1992). The motivation is if you can to read/elucidate it in your home what's the nature of the regularity explained in this experiment. $\endgroup$
    – user142929
    Nov 30, 2019 at 13:08
  • 1
    $\begingroup$ In the paper RNA Structure Based on Prime Number Sequence Sluyser and Sonnhammer suggest that it would be energetically favorable to construct RNA via an encoding of the AUCG base nucleotides in terms of prime numbers. No motivation is given for this encoding, it seems purely speculative. $\endgroup$ Nov 30, 2019 at 14:59
  • $\begingroup$ What I would like to know is if it is possible to determine what is the specific regularity in prime numbers that are producing the regularity in the sequences of RNA that were encoded from the first primes (I interpret that Feedback, by Ian Stewart, reported some kind of regularity that seems to me an unveiled mystery). I don't know if it is possible to repeat or do variants of the experiment due to Sluyser and Sonnhammer with the intention to elucidate what is the specific regularity in primes that produces the regularity in the outputs of the analyzer of sequences of RNA. Many thanks. $\endgroup$
    – user142929
    Dec 3, 2019 at 13:52
  • 3
    $\begingroup$ Optical sieve? Lehmer built one of those in 1932, an improvement on his bicycle chain sieve of 1927. See people.ucalgary.ca/~hwilliam/Sieve_Pictures.pdf and en.wikipedia.org/wiki/Lehmer_sieve $\endgroup$ May 5, 2020 at 23:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.