Finding Line Segments in the Ulam Square with the Hough Transform

  • Leszek J. ChmielewskiEmail author
  • Arkadiusz Orłowski
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 9972)


The regularities present in the Ulam spiral provided an incentive for interesting observations in the number theory. Therefore, we have made the Ulam square an object of analysis from the image processing perspective. A version of the Hough transform designed specially for detecting sequences of pixels forming segments of straight lines with the slope defined by an irreducible fraction was used to find line segments in the Ulam spiral. Angles which described the slopes of the segments had tangents p / q expressed by integers p from 0 to 10 and q from \(-10\) to 10 (0 excluded). Due to storage limitations the squares with the side of length up to 5001 points which correspond to the largest prime \(25\,009\,991\) were analyzed at present. In such a square the longest segment has 16 primes and its tangent is 3 (3 up and 1 to the right). Segments of length 14 and 15 were absent. The number of shorter segments varied strongly, from one for a 13-point segment to tens of thousands for shorter ones.


Ulam spiral Line segments Long Contiguous Hough transform Image processing 


  1. 1.
    Euler, L.: Extrait d’un lettre de M. Euler le Pere à M. Bernoulli concernant le mémoire imprimé parmi œux de 1771. Nouveaux Mémoires de l’Académie Royale des Sciences et Belles-Lettres (1772), pp. 35–36.
  2. 2.
    Stein, M.L., Ulam, S.M., Wells, M.B.: A visual display of some properties of the distribution of primes. Am. Math. Mon. 71(5), 516–520 (1964). doi: 10.2307/2312588 MathSciNetCrossRefzbMATHGoogle Scholar
  3. 3.
    Leavers, V.F.: Which Hough transform? CVGIP Image Underst. 58, 250–264 (1993). doi: 10.1006/ciun.1993.1041 CrossRefGoogle Scholar
  4. 4.
    Antolovic, D.: Review of the Hough transform method, with an implementation of the fast Hough variant for line detection. Indiana University, Department of Computer Science (2008)Google Scholar
  5. 5.
    Mukhopadhyay, P., Chaudhuri, B.B.: A survey of Hough transform. Pattern Recogn. 48(3), 993–1010 (2015). doi: 10.1016/j.patcog.2014.08.027 CrossRefGoogle Scholar
  6. 6.
    Hassanein, A.S., Mohammad, S., Sameer, M., Ragab, M.E.: A survey on Hough trans-form, theory, techniques and applications. CoRR abs/1502.02160 arXiv:1502.02160 (2015)
  7. 7.
    Kiryati, N., Lindenbaum, M., Bruckstein, A.M.: Digital or analog Hough transform? Pattern Recogn. Lett. 12(5), 291–297 (1991). doi: 10.1016/0167-8655(91)90412-F CrossRefGoogle Scholar
  8. 8.
    Cyganski, D., Noel, W.F., Orr, J.A.: Analytic Hough transform. In: Proceedings of SPIE: Sensing and Reconstruction of Three-Dimensional Objects and Scenes, vol. 1260, pp. 148–159 (1990). doi: 10.1117/12.20013
  9. 9.
    Liu, Y., Cyganski, D., Vaz, R.F.: Efficient implementation of the analytic Hough transform for exact linear feature extraction. In: Proceedings of SPIE, Intelligent Robots and Computer Vision X: Algorithms and Techniques, vol. 1607, pp. 298–309 (1992). doi: 10.1117/12.57109
  10. 10.
    Chmielewski, L.J., Orłowski, A.: Hough transform for lines with slope defined by a pair of co-primes. Mach. Graph. Vis. 22(1/4), 17–25 (2013)Google Scholar
  11. 11.
    Chmielewski, L.J., Orłowski, A.: Prime numbers in the Ulam square (2016). Accessed 14 July 2016

Copyright information

© Springer International Publishing AG 2016

Authors and Affiliations

  1. 1.Faculty of Applied Informatics and Mathematics (WZIM)Warsaw University of Life Sciences (SGGW)WarsawPoland

Personalised recommendations