%% to be compiled with pdflatex

\documentclass{amsart}

\usepackage{tikz}
\usetikzlibrary{calc}

\begin{document}
\thispagestyle{empty}

\centerline{%
  \tikzpicture

  \path[fill=black!10]
  (0,0) coordinate (P0) arc (180:0:4)
  node[midway,above] {$0$} ;

  \path
  foreach \i in {1,...,8} {
    (\i,0) coordinate (P\i)
    +(-1/2,0) coordinate (Q\i)
    node[below] {$\i$} } ;

  \def\HALFCIRCLES{
    0/8/{R03,Q4,R48},
    0/3/{Q1,Q2,Q3},
    4/8/{R46,Q7,Q8},
    4/6/{Q5,Q6}}

  \draw[thick]
  (P0) -- (P8)
  foreach \i/\j in \HALFCIRCLES {
    (P\i) arc (180:0:{(\j-\i)/2})
    coordinate[midway] (R\i\j) } ;

  \fill[radius=1pt]
  foreach \i in {0,1,...,8} { (P\i) circle[] } ;

  \draw[blue]
  foreach \i/\j/\L in \HALFCIRCLES {
    (R\i\j) -- +(0,-1/4)
    foreach \E in \L { edge (\E) } } ;

  \fill[blue,radius=1.5pt]
  (R08) circle[]
  foreach \i in {1,...,8} { (Q\i) circle[] } ;

  \node[below=1em/3] at (current bounding box.south) {$((123)4((56)78))$} ;

  \endtikzpicture
} % \centerline
\end{document}

%%%%%%%%

%% png creation (normal size, transparent)

%%% pdflatex halfcircles.tex
%%% pdftocairo -png -singlefile -transp halfcircles.pdf tmp
%%% magick -define png:exclude-chunk=date,time tmp.png -trim +repage halfcircles.png
%%% optipng halfcircles.png

%%%% Default resolution of pdftocairo is 150 ppi.

%%%% magick adds white (fallback) background to the transparent image
%%%% and has the convenient option -trim.

%%%% Image size is 477x321.

%% program versions

%%% This is pdfTeX, Version 3.14159265-2.6-1.40.20 (TeX Live 2019/Debian) (preloaded format=pdflatex)
%%% Document Class: amsart 2017/10/31 v2.20.4
%%% Package: tikz 2020/01/08 v3.1.5b (3.1.5b)

%%% pdftocairo version 0.86.1
%%% ImageMagick 7.1.1-43 Q16-HDRI x86_64 22550 https://imagemagick.org
%%% OptiPNG version 0.7.7

%%%%%%%%

%%%% First version:
%%% 2025-10-02

%%%% Latest change of image:
%%% 2025-10-05 % decreased distance of caption

%%%% Latest code change:
%%% 2025-10-05

%%%%%%%%
