Making bar numbers appear at regular intervals

If you would like the bar numbers to appear at regular intervals, but not starting from measure zero, you can use a context function, set-bar-number-visibility, to set automatically barNumberVisibility, so that the bar numbers appear at regular intervals, starting from the measure in which set-bar-number-visibility is set using \applycontext.

\version "2.24.0"

%% http://lsr.di.unimi.it/LSR/Item?id=91

resetBarnum = \context Score \applyContext #(set-bar-number-visibility 4)

\score {
    <<
         \transpose c c'' {
	    \override Score.BarNumber.break-visibility =#end-of-line-invisible
	    \override Score.RehearsalMark.padding = #2.5
	    \mark "A" \resetBarnum
	    \repeat unfold 10 c1
	    \mark \default \resetBarnum
	    \repeat unfold 8 c
            \bar "|."
        }
    >>
  \layout { ragged-right = ##t }
}