# Bayesian multi-exposure image fusion for robust
high dynamic range ptychography

Shantanu Kodgirwar  Lars Loetgering  Chang Liu  Aleena Joseph  Leona Licht
Daniel S. Penagos Molina  Wilhelm Eschen  Jan Rothhardt  Michael Habeck

###### Abstract

Image information is restricted by the dynamic range of the detector, which
can be addressed using multi-exposure image fusion (MEF). The conventional MEF
approach employed in ptychography is often inadequate under conditions of low
signal-to-noise ratio (SNR) or variations in illumination intensity. To
address this, we developed a Bayesian approach for MEF based on a modified
Poisson noise model that considers the background and saturation. Our method
outperforms conventional MEF under challenging experimental conditions, as
demonstrated by the synthetic and experimental data. Furthermore, this method
is versatile and applicable to any imaging scheme requiring high dynamic range
(HDR).

Machine Learning, ICML

##  1 Introduction

Detectors can only capture signals whose intensities are within the limits of
their dynamic range. To surpass the limits of a detector, we can employ a
multi-exposure image fusion (MEF) approach (Xu et al., 2022) by acquiring
images at different exposure times ranging from under- to overexposed and
fusing them into a single high dynamic range (HDR) image. Many MEF algorithms
have been proposed (Zhang, 2021; Xu et al., 2022) with some adoption in
microscopy (Yin et al., 2015; Singh et al., 2022; Liu et al., 2023). In
coherent diffractive imaging (CDI), use of the aforementioned HDR image fusion
algorithms has been limited (Baksh et al., 2016; Rose et al., 2018; Lo et al.,
2018), predominantly relying on a similar approach referred to as the
conventional MEF method in this work. Instead, experimental techniques based
on wavefront modulation have been introduced to relax the dynamic range
requirements (Zhang et al., 2016; Odstrčil et al., 2019; Eschen et al., 2024).

Ptychography, a scanning CDI method, has gained popularity as a ”lensless”
computational imaging scheme allowing for simultaneous phase microscopy and
wavefront sensing (Maiden & Rodenburg, 2009; Rodenburg & Maiden, 2019). It
involves laterally moving a thin specimen across localized illumination while
recording a series of diffraction patterns. By leveraging the overlap between
adjacent scan positions, the captured diffraction data can be transformed into
complex-valued reconstructions of the specimen and illumination wavefront
using a phase-retrieval algorithm (Fig. 1a). The exposure time is a critical
parameter for the acquisition of diffraction patterns. Photons diffracted
towards large angles tend to exhibit lower intensities, resulting in a poorer
signal-to-noise ratio (SNR). These photons carry high-spatial frequency
information and are usually accessible through measurements with longer
acquisition times, which may result in saturation of the pixels at the center
of the diffraction patterns. Therefore, MEF (Fig. 1b) can be employed as a
preprocessing step in ptychography to achieve a diffraction-limited
resolution.

We briefly review the conventional MEF strategy (Baksh et al., 2016; Rose et
al., 2018) before presenting our solution. For every scan position, multiple
diffraction patterns $n_{i}(\boldsymbol{q})$ are recorded for varying
acquisition times $t_{i}$ ($i=1,\ldots,K$), where $K$ denotes the number of
acquisitions and $\boldsymbol{q}$ represents the pixel index. The background
estimate $b_{i}(\boldsymbol{q})$ characterizes camera readout noise. A simple
correction for background noise is the subtraction from the diffraction
patterns
$n_{i}^{+}(\boldsymbol{q}):=\max{\left(0,n_{i}(\boldsymbol{q})-b_{i}(\boldsymbol{q})\right)}$,
where the max operation enforces nonnegativity. For every acquisition time
$t_{i}$, there is an associated flux factor $c_{i}\approx t_{i}$. These
patterns are then fused together into an estimated diffraction intensity
$\mathcal{I}(\boldsymbol{q})$ based on maximum likelihood estimation (MLE)
under the assumption of Poisson noise (see supplementary section B):

$\displaystyle\mathcal{I}(\boldsymbol{q})$
$\displaystyle=\frac{\sum_{i}w_{i}(\boldsymbol{q})n_{i}^{+}(\boldsymbol{q})}{\sum_{i}w_{i}(\boldsymbol{q})c_{i}(\boldsymbol{q})},$
(1) $\displaystyle\text{where},w_{i}(\boldsymbol{q})$
$\displaystyle=\begin{cases}1,&\text{$\boldsymbol{q}$ is not saturated}\\\
0,&\text{$\boldsymbol{q}$ is saturated}\end{cases}$

Pixel-wise binary weight $w_{i}(\boldsymbol{q})$ ensures that only unsaturated
data are used for the fusion process. Even if the exposure time is accurately
known, conventional MLE suffers from several shortcomings, especially under
low-SNR conditions. The background subtraction procedure clips negative values
to zero, resulting in a loss of information. The $\max$ operation also
introduces nonlinearity into intensity estimation, leading to a potential bias
(Seifert et al., 2023). Additionally, this approach ignores saturated data,
contributing to another source of information loss and leading to a suboptimal
fusion result. Moreover, the flux factors $c_{i}$ may not be known accurately.
In the case of probe intensity fluctuations (Odstrcil et al., 2016) or if the
detector behaves nonlinearly under varying exposure times (Shafie et al.,
2009), the conventional approach relies on a heuristic estimate of the flux
factors, which affects the quality of fusion. In addition, recognizing the
advantage of modifying the optical intensity, especially by increasing it
while adjusting the camera exposure times, can prove beneficial for faster
data acquisition. In this case, the uncertainty in $c_{i}$ will increase,
introducing systematic errors in the fused data, thereby significantly
affecting phase retrieval.

To tackle these issues and achieve robust HDR imaging in ptychography, this
letter proposes a principled Bayesian approach to multi-exposure image fusion
which we refer to here as the Bayesian MEF method. We start by explaining our
probabilistic model, followed by demonstrating simulation results under low
SNR conditions, assuming fixed and accurately known flux factors.
Subsequently, we show the efficacy of our approach by using experimental data
in a high SNR, and high photon count setting, where the flux factors are only
heuristically known.

Figure 1: (a) Principle of conventional ptychography from data acquisition to
phase retrieval. (b) Diffraction patterns recorded at increasing exposure
times (bright red pixels are saturated) and fused to achieve a high dynamic
range (HDR) image.

##  2 Bayesian MEF

At the core of a Bayesian approach is the likelihood, a probabilistic model
for the data. Here, the model must account for two effects: (a) background
noise and (b) saturation owing to overexposure. Suppose we ignore the
background noise and saturation effects. In that case, an appropriate
likelihood for the $i$-th exposure is a Poisson distribution with mean
$c_{i}\mathcal{I}(\boldsymbol{q})$, i.e.
$n_{i}(\boldsymbol{q})\sim\text{Poi}\left(c_{i}\mathcal{I}(\boldsymbol{q})\right)$
where $\sim$ denotes ”follows the distribution” (Thibault & Guizar-Sicairos,
2012). The second component of the Bayesian model is the prior. We assume a
Gamma distribution as a prior with shape and scale parameters
$\alpha_{\mathcal{I}}$ and $\beta_{\mathcal{I}}$. This choice encodes the
assumption that $\mathcal{I}$ is non-negative and constant on average,
$\mathcal{I}(\boldsymbol{q})\approx\alpha_{\mathcal{I}}/\beta_{\mathcal{I}}$,
and the fluctuations in $\mathcal{I}$ are on the order of
$\alpha_{\mathcal{I}}/\beta_{\mathcal{I}}^{2}$ (Gelman et al., 2013). In case
we have more detailed prior knowledge about $\mathcal{I}$, it can be
incorporated by letting $\alpha_{\mathcal{I}}$ and $\beta_{\mathcal{I}}$
depend on pixel location $\boldsymbol{q}$. We also assume gamma priors for the
unknown flux factors $c_{i}$ where the hyperparameters $\alpha_{i},\beta_{i}$
are typically chosen such that the expected flux factor equals the acquisition
time $\alpha_{i}/\beta_{i}=t_{i}$. The conditional posterior distributions for
$\mathcal{I}(\boldsymbol{q})$ and $c_{i}$ are also gamma distributions. The
model parameters can be estimated by iterating over the updates

$\displaystyle c_{i}^{(k+1)}$
$\displaystyle=\frac{\alpha_{i}+\sum_{\boldsymbol{q}}n_{i}(\boldsymbol{q})}{\beta_{i}+\sum_{\boldsymbol{q}}\mathcal{I}^{(k)}(\boldsymbol{q})},$
(2) $\displaystyle\mathcal{I}^{(k+1)}(\boldsymbol{q})$
$\displaystyle=\frac{\alpha_{\mathcal{I}}+\sum_{i}n_{i}(\boldsymbol{q})}{\beta_{\mathcal{I}}+\sum_{i}c_{i}^{(k+1)}}$

with iteration index denoted by superscript $(k)$. The derivation of the
updates in Eq. (2) and the choice of hyperparameters
$\alpha_{\mathcal{I}},\beta_{\mathcal{I}}$, etc., are provided in the
supplementary section C.1. For $\alpha_{\mathcal{I}}=\beta_{\mathcal{I}}=0$,
the estimate for $\mathcal{I}(\boldsymbol{q})$ matches the maximum-likelihood
estimate for the unsaturated pixels in Eq. (1).

To model the readout noise, we consider the mean
$c_{i}\mathcal{I}(\boldsymbol{q})$ to be shifted by the background mean
$b_{i}(\boldsymbol{q})$ such that
$n_{i}(\boldsymbol{q})\sim\text{Poi}\left(c_{i}\mathcal{I}(\boldsymbol{q})+b_{i}(\boldsymbol{q})\right)$.
Since the sum of two Poisson distributions is again a Poisson distribution
with both means added together, the data can be interpreted as the sum of the
background counts generated from
$\text{Poi}\left(b_{i}(\boldsymbol{q})\right)$ and noisefree counts
$n_{\mathcal{I}i}(\boldsymbol{q})\sim\text{Poi}\left(c_{i}\mathcal{I}(\boldsymbol{q})\right)$.
Only the sum of the background and noisefree counts is observed; however,
$n_{\mathcal{I}i}(\boldsymbol{q})$ can be estimated from
$n_{i}(\boldsymbol{q})$. The conditional posterior of the noisefree counts is
a binomial distribution (see supplementary section C.2), and their expected
values are

$\mathbb{E}[n_{\mathcal{I}i}(\boldsymbol{q})\mid\mathcal{I}(\boldsymbol{q}),c_{i},b_{i}(\boldsymbol{q})]=\frac{c_{i}\mathcal{I}(\boldsymbol{q})}{c_{i}\mathcal{I}(\boldsymbol{q})+b_{i}(\boldsymbol{q})}n_{i}(\boldsymbol{q})\,.$
(3)

These are fractions of the observed counts $n_{i}(\boldsymbol{q})$, which
differ from estimating $n_{\mathcal{I}i}$ by subtracting the background.

To take the saturated pixels into account, we assume that the data
$n_{i}(\boldsymbol{q})$ are censored at the detector threshold ${n^{*}}$
meaning that they are clipped at a maximum value of ${n^{*}}$. The likelihood
is a (right-) censored Poisson distribution (i.e., the right tail of the
Poisson distribution is not observed). Let $\nu_{i}(\boldsymbol{q})$ denote
the latent uncensored counts,
$\nu_{i}(\boldsymbol{q})\sim\text{Poi}\left(c_{i}\mathcal{I}(\boldsymbol{q})+b_{i}(\boldsymbol{q})\right)$
then, the observed data can be modeled as
$n_{i}(\boldsymbol{q})=\nu_{i}(\boldsymbol{q})$ if
$\nu_{i}(\boldsymbol{q})<{n^{*}}$ (or equivalently,
$w_{i}(\boldsymbol{q})=1$), and $n_{i}(\boldsymbol{q})={n^{*}}$ if
$\nu_{i}(\boldsymbol{q})\geq{n^{*}}$ (or $w_{i}(\boldsymbol{q})=0$). If we
know $\nu_{i}(\boldsymbol{q})$, then parameter estimation would simplify to
background removal under the Poisson model, as in Eq. (3). However, since we
do not observe the uncensored counts directly, we have to estimate them. This
can be achieved with conditional posteriors

$\displaystyle\nu_{i}(\boldsymbol{q})$
$\displaystyle\sim\begin{cases}\text{TruncPoi}\left(c_{i}\mathcal{I}(\boldsymbol{q})+b_{i}(\boldsymbol{q}),{n^{*}}-1\right),\\!\\!&w_{i}(\boldsymbol{q})=0\\\
\text{Poi}\left(c_{i}\mathcal{I}(\boldsymbol{q})+b_{i}(\boldsymbol{q})\right),&w_{i}(\boldsymbol{q})=1\end{cases}$
(4) $\displaystyle\nu_{\mathcal{I}i}(\boldsymbol{q})$
$\displaystyle\sim\text{Binomial}\left(\nu_{i}(\boldsymbol{q}),\frac{c_{i}\mathcal{I}(\boldsymbol{q})}{c_{i}\mathcal{I}(\boldsymbol{q})+b_{i}(\boldsymbol{q})}\right)$
$\displaystyle\mathcal{I}(\boldsymbol{q})$
$\displaystyle\sim\text{Gamma}\bigl{(}\alpha_{\mathcal{I}}+\sum_{i}\nu_{\mathcal{I}i}(\boldsymbol{q}),\beta_{\mathcal{I}}+\sum_{i}c_{i}\bigr{)}$

where $\nu_{\mathcal{I}i}(\boldsymbol{q})$ are the noisefree contributions to
the uncensored counts $\nu_{i}(\boldsymbol{q})$ and TruncPoi denotes the
truncated Poisson distribution (Plackett, 1953). We can now employ the
expectation-maximization (EM) (Dempster et al., 1977) algorithm to estimate
the fused diffraction pattern $\mathcal{I}$ (see supplementary section C.3 for
details). The E-step gives the expectation of $\nu_{i}$, allowing us to
estimate $\nu_{\mathcal{I}i}$ and the M-step maximizes our estimate of
$\mathcal{I}$ in the presence of incomplete data.

Figure 2: (a) Synthetic diffraction patterns (log-scale) for a particular scan
position under strong scattering ($\rho=1.0$) and weak scattering ($\rho=0.3$)
corresponding to different flux factors $c_{i}$. The third acquisition
($c_{3}=64.0$) exhibits saturation (bright red pixels). The data is then fused
with conventional and Bayesian MEF methods. (b) Comparing ptychographic
reconstructions (amplitude and phase) of the ground truth with MEF fused
result from the synthetic data for $\rho=1.0$ (top-row) and $\rho=0.3$
(bottom-row). (c) Evaluating the mean structural similarity index (MSSIM) for
reconstructed phase with data generated by varying $\rho$.

Algorithm 1 summarizes the Bayesian MEF updates. The key steps are: Estimation
of the uncensored counts $\nu_{i}$ via their expected values under the
truncated Poisson distribution (line 4), background removal (line 5) analogous
to Eq. (3), updating the flux factors (line 6), and estimation of the fused
pattern (line 7). This procedure iteratively reduces the measured readout
noise in addition to estimating the saturated pixels for correcting flux
factors and fusing the diffraction patterns.

Algorithm 1 Bayesian MEF algorithm

1: Initialize $\alpha_{\mathcal{I}}=\beta_{\mathcal{I}}=0.001$,
$\alpha_{i}=1.0$ and $\beta_{i}=t_{i}^{-1}$

2: Initialize $c_{i}^{(0)}=t_{i}$,
$\mathcal{I}^{(0)}=\frac{\alpha_{\mathcal{I}}+\sum_{i}w_{i}n_{i}}{\beta_{\mathcal{I}}+\sum_{i}w_{i}t_{i}}$

3: repeat

4: $\nu_{i}^{(k+1)}\leftarrow
w_{i}n_{i}+\left(1-w_{i}\right)\mathbb{E}[\nu_{i}|c_{i}^{(k)}\mathcal{I}^{(k)}+b_{i},{n^{*}}-1]$

5:
$\nu_{\mathcal{I}i}^{(k+1)}\leftarrow\frac{c_{i}^{(k)}\mathcal{I}^{(k)}}{c_{i}^{(k)}\mathcal{I}^{(k)}+b_{i}}\scriptsize{\nu_{i}^{(k+1)}}$

6:
$c_{i}^{(k+1)}\leftarrow\frac{\alpha_{i}+\sum_{\boldsymbol{q}}\nu_{\mathcal{I}i}^{(k+1)}(\boldsymbol{q})}{\beta_{i}+\sum_{\boldsymbol{q}}\mathcal{I}^{(k)}(\boldsymbol{q})}$

7:
$\mathcal{I}^{(k+1)}\leftarrow\frac{\alpha_{\mathcal{I}}+\sum_{i}\nu_{\mathcal{I}i}^{(k+1)}}{\beta_{\mathcal{I}}+\sum_{i}c_{i}^{(k+1)}}$

8: $k\leftarrow k+1$

9: until converge

##  3 Simulations for low SNR data with known flux factors

To study the performance of Bayesian MEF, we considered synthetic data in a
low-SNR setting. We fixed the flux factors $c_{i}=t_{i}$ and did not estimate
them. To simulate a low-SNR condition, we considered a weakly scattering
specimen. The signal from the specimen in the far-field diffraction pattern is
not just weak but also dominated by the unscattered probe, increasing the shot
noise and thereby lowering the effective SNR (see supplementary section D.1).
The ptychographic reconstruction of these data is usually more challenging
(Dierolf et al., 2010). In general, a phase object is given by
$O(\boldsymbol{q})=\exp{\big{(}i\phi(\boldsymbol{q})\big{)}}$ where
$\rho\approx\max\big{(}\phi(\boldsymbol{q})\big{)}$ denotes the maximum phase.
Smaller values of $\rho$ result in weaker scattering, corresponding to a
weakly phase-modulating specimen. To systematically study the impact on
ptychographic reconstructions, we simulated the data by varying $\rho$ from
weakly scattering $\rho=0.3$ to strongly scattering $\rho=1.0$. For a given
$\rho$, the diffraction patterns are simulated using our forward model
$n_{i}(\boldsymbol{q})\sim\text{Poi}\left(c_{i}\mathcal{I}(\boldsymbol{q})+b_{i}(\boldsymbol{q})\right)$
where the additive background is drawn from the Gaussian distribution
$b_{i}(\boldsymbol{q})\sim\mathcal{N}(\mu_{b},\sigma^{2}_{b})$ (Seifert et
al., 2023). Usually, the background counts are a small fraction of the actual
data and remain fairly constant with low spatial variance. Therefore, we
choose $\mu_{b}=100$ and $\sigma^{2}_{b}=0.8$. We set $c_{i}$ to 1, 8, and 64,
corresponding to maximum photon counts of $2^{7},2^{10}$ and $2^{13}$,
respectively. The data was censored at a threshold of $2^{11}$ causing
saturation mainly in the third acquisition. The simulated diffraction patterns
are shown in Fig. 2a, where acquisitions for a specific scan position were
generated for $\rho=1.0$ and $\rho=0.3$. For the third acquisition
($c_{3}=64$), the number of saturated pixels was $\approx 2.3$ times higher
for $\rho=0.3$ than for $\rho=1.0$, further increasing the level of
uncertainty in the fusion of data from the weakly scattering specimen. For
each exposure time, we repeated the measurement six times, fusing $18$
measurements per scan point. Utilizing fused data from all scan positions, we
employed the momentum acceleration (mPIE) (Maiden et al., 2017) phase
retrieval algorithm implemented in the open-source package _PtyLab_
(Loetgering et al., 2023). Fig. 2b compares the impact of the MEF methods on
the reconstruction of a spokes target as our phase object. The reconstruction
quality was significantly better with the Bayesian MEF method for strongly as
well as weakly scattering data. Supplementary Fig. 5 compares the results for
$\rho$ varying from $0.3$ to $1.0$ showing improved reconstructions for all
cases. These results are corroborated by evaluating the mean structural
similarity (MSSIM) index (Wang et al., 2004) for phase reconstructions by
varying $\rho$ (see Fig. 2c). Supplementary section D.2 contains more details
on the MSSIM metric as well as its use. As seen here, our method consistently
shows higher MSSIM values for all values of $\rho$, whereas the improvement in
the conventional case remains stagnant even for $\rho$ corresponding to
strongly scattering ($\rho=1.0$) data.

##  4 Experimental demonstration for high SNR data with heuristic flux factors

The tests with synthetic data utilized the known flux factors $c_{i}$.
However, these may or may not be known from an experiment. In the following
experimental tests, we have a high SNR and high photon count setting; however,
the flux factors are only heuristically known. We demonstrate that the fusion
results from the conventional case become unreliable when the flux factors
deviate significantly from the actual values. One such case is when the
illumination intensity also varies with camera exposure time. In this case, we
only have access to heuristic estimate $c_{i}^{heu}$. It can be calculated by
summing the uncensored data for every acquisition and dividing it by the sum
of uncensored data for a fixed acquisition. For example, out of $K$
acquisitions, the fixed acquisition could be the middle one $i=K/2$. The
Bayesian MEF approach, outlined in algorithm 1, should iteratively correct the
heuristic flux factors by setting $c_{i}^{(0)}=c_{i}^{heu.}$. To test this, we
constructed a conventional ptychography setup in transmission geometry. A
coherent laser source from SuperK COMPACT, offering manual adjustment of the
laser power in percentage was employed. We chose a wavelength of $625\,nm$, a
probe size of $400\,\mu m$, and used an unstained histological mouse section
as our test object. Diffraction data was recorded at $500$ scan positions
using a Lucid CMOS camera with a $12$ bit analog-to-digital converter (ADC)
and a binning factor of $8$, allowing a maximum of $2^{18}$ counts.

Figure 3: (a) Diffraction patterns recorded with varying laser power $L_{p}$
in percentage and camera acquisition times $t_{i}$. The second and the third
acquisitions are overexposed. (b) Ptychographic reconstructions using the two
MEF methods.

For additional experimental details, please refer to supplementary section E.
We recorded three acquisitions by varying the exposure time and the laser
power in percentage (refer to Fig. 3a). Each acquisition was repeated thrice,
necessitating the fusion of nine diffraction patterns per scan. For each
acquisition, $150$ dark-frame measurements were recorded and averaged. For the
conventional MEF case, we applied the background subtraction procedure to the
diffraction patterns and estimated the flux factors heuristically.
Subsequently, the conventional MEF method was applied, resulting in a largely
unsuccessful ptychographic reconstruction, as depicted in the left panel of
Fig. 3b. However, our method corrects the heuristic flux factors and estimates
fused patterns, leading to a high-quality ptychographic reconstruction (see
Fig. 3b, right panel). It is expected that both MEF methods yield comparable
results in a high SNR and high photon count scenario, where flux factors are
accurately known. This is verified by utilizing the corrected fluxes from our
method and using them for the conventional MEF case, leading to visually
indistinguishable reconstructions (see Fig. 4).

Figure 4: (a) Heuristic flux factors are corrected by our EM algorithm (shown
in log-scale) for the nine measurements (each acquisition repeated thrice) for
every scan position. (b) Conventional MEF reconstruction that used the
corrected fluxes from our EM algorithm.

##  5 Summary

We introduced a Bayesian approach for MEF that incorporates image formation
statistics with priors in a principled manner. Our findings illustrate
enhanced HDR phase retrieval, particularly under challenging conditions such
as low SNR or variations in illumination intensity. It can also be noted that
conventional MEF is merely a special case of the Bayesian MEF method, which is
verified when both methods perform equivalently with known flux factors in a
high SNR regime. Currently, MEF is a preprocessing step for ptychography, and
an extension of this work could be the integration of our Bayesian model
directly into a ptychography framework based on automatic differentiation (AD)
(Kandel et al., 2019), potentially further enhancing robustness in HDR
ptychographic reconstructions. Additionally, exploring physics-informed priors
could improve the estimation in scenarios with limited data or expedite
algorithmic convergence.

In summary, the results showcased in this study suggest noteworthy
advancements in the field of computational imaging. Our work shows promise for
imaging challenging weakly scattering specimens or when access to high-quality
detectors at extreme wavelengths (Thibault et al., 2008; Loetgering et al.,
2022) is either limited or expensive. Furthermore, Bayesian MEF extends its
utility beyond CDI to encompass any imaging scheme that necessitates HDR
treatment.

## Acknowledgements

SK and MH acknowledge funding by the Carl Zeiss Foundation within the program
“CZS Stiftungsprofessuren” and by the German Research Foundation (DFG) within
grant HA 5918/4-1. The remaining authors acknowledge support from the
Helmholtz Association (ZT-I-PF-4-018 AsoftXm), the Free State of Thuringia and
the European Social Fund Plus (2023 FGR0053).

## Data Availability Statement

The data used in this work and the algorithms implemented as a software
package can be found in Ref. (Kodgirwar et al., 2024).

## References

  * Baksh et al. (2016) Baksh, P. D., Odstrčil, M., Kim, H.-S., Boden, S. A., Frey, J. G., and Brocklesby, W. S.  Wide-field broadband extreme ultraviolet transmission ptychography using a high-harmonic source.  _Opt. Lett._ , 41(7):1317–1320, Apr 2016.
  * Dempster et al. (1977) Dempster, A. P., Laird, N. M., and Rubin, D. B.  Maximum likelihood from incomplete data via the em algorithm.  _Journal of the Royal Statistical Society: Series B (Methodological)_ , 39(1):1–22, 1977.
  * Dierolf et al. (2010) Dierolf, M., Thibault, P., Menzel, A., Kewish, C. M., Jefimovs, K., Schlichting, I., von König, K., Bunk, O., and Pfeiffer, F.  Ptychographic coherent diffractive imaging of weakly scattering specimens.  _New Journal of Physics_ , 12(3):035017, Mar 2010\.
  * Eschen et al. (2024) Eschen, W., Liu, C., Steinert, M., Molina, D. S. P., Siefke, T., Zeitner, U. D., Kaspar, J., Pertsch, T., Limpert, J., and Rothhardt, J.  Structured illumination ptychography and at-wavelength characterization with an euv diffuser at 13.5 nm wavelength.  _Opt. Express_ , 32(3):3480–3491, Jan 2024.
  * Gelman et al. (2013) Gelman, A., Carlin, J. B., Stern, H. S., Dunson, D. B., Vehtari, A., and Rubin, D. B.  _Bayesian Data Analysis_.  Chapman and Hall/CRC, November 2013.
  * Kandel et al. (2019) Kandel, S., Maddali, S., Allain, M., Hruszkewycz, S. O., Jacobsen, C., and Nashed, Y. S. G.  Using automatic differentiation as a general framework for ptychographic reconstruction.  _Opt. Express_ , 27(13):18653–18672, Jun 2019\.
  * Kodgirwar et al. (2024) Kodgirwar, S., Loetgering, L., Liu, C., Joseph, A., Licht, L., Molina, D. S. P., Eschen, W., Rothhardt, J., and Habeck, M.  Supplementary software and data: Bayesian multi-exposure image fusion for robust high dynamic range preprocessing in ptychography, March 2024\.
  * Liu et al. (2023) Liu, J., Liu, C., Zou, C., Zhao, Y., and Liu, J.  Large dynamic range dark-field imaging based on microscopic images fusion.  _Optics Communications_ , 528:128966, 2023.  ISSN 0030-4018.
  * Lo et al. (2018) Lo, Y. H., Zhao, L., Gallagher-Jones, M., Rana, A., J. Lodico, J., Xiao, W., Regan, B. C., and Miao, J.  In situ coherent diffractive imaging.  _Nature Communications_ , 9(1):1826, May 2018\.  ISSN 2041-1723.
  * Loetgering et al. (2022) Loetgering, L., Witte, S., and Rothhardt, J.  Advances in laboratory-scale ptychography using high harmonic sources [invited].  _Opt. Express_ , 30(3):4133–4164, Jan 2022.
  * Loetgering et al. (2023) Loetgering, L., Du, M., Flaes, D. B., Aidukas, T., Wechsler, F., Molina, D. S. P., Rose, M., Pelekanidis, A., Eschen, W., Hess, J., Wilhein, T., Heintzmann, R., Rothhardt, J., and Witte, S.  Ptylab.m/py/jl: a cross-platform, open-source inverse modeling toolbox for conventional and fourier ptychography.  _Opt. Express_ , 31(9):13763–13797, Apr 2023\.
  * Maiden et al. (2017) Maiden, A., Johnson, D., and Li, P.  Further improvements to the ptychographical iterative engine.  _Optica_ , 4(7):736–745, Jul 2017.
  * Maiden & Rodenburg (2009) Maiden, A. M. and Rodenburg, J. M.  An improved ptychographical phase retrieval algorithm for diffractive imaging.  _Ultramicroscopy_ , 109(10):1256–1262, 2009.  ISSN 0304-3991.
  * Odstrcil et al. (2016) Odstrcil, M., Baksh, P., Boden, S. A., Card, R., Chad, J. E., Frey, J. G., and Brocklesby, W. S.  Ptychographic coherent diffractive imaging with orthogonal probe relaxation.  _Opt. Express_ , 24(8):8360–8369, Apr 2016.
  * Odstrčil et al. (2019) Odstrčil, M., Lebugle, M., Guizar-Sicairos, M., David, C., and Holler, M.  Towards optimized illumination for high-resolution ptychography.  _Opt. Express_ , 27(10):14981–14997, May 2019\.
  * Plackett (1953) Plackett, R. L.  The truncated poisson distribution.  _Biometrics_ , 9(4):485, December 1953.
  * Rodenburg & Maiden (2019) Rodenburg, J. and Maiden, A.  _Ptychography_ , pp. 819–904.  Springer International Publishing, Cham, 2019.  ISBN 978-3-030-00069-1.
  * Rose et al. (2018) Rose, M., Senkbeil, T., von Gundlach, A. R., Stuhr, S., Rumancev, C., Dzhigaev, D., Besedin, I., Skopintsev, P., Loetgering, L., Viefhaus, J., Rosenhahn, A., and Vartanyants, I. A.  Quantitative ptychographic bio-imaging in the water window.  _Opt. Express_ , 26(2):1237–1254, Jan 2018.
  * Seifert et al. (2023) Seifert, J., Shao, Y., van Dam, R., Bouchet, D., van Leeuwen, T., and Mosk, A. P.  Maximum-likelihood estimation in ptychography in the presence of poisson–gaussian noise statistics.  _Opt. Lett._ , 48(22):6027–6030, Nov 2023.
  * Shafie et al. (2009) Shafie, S., Kawahito, S., Halin, I. A., and Hasan, W. Z. W.  Non-linearity in wide dynamic range CMOS image sensors utilizing a partial charge transfer technique.  _Sensors (Basel)_ , 9(12):9452–9467, Nov 2009\.
  * Singh et al. (2022) Singh, H., Cristobal, G., Bueno, G., Blanco, S., Singh, S., Hrisheekesha, P., and Mittal, N.  Multi-exposure microscopic image fusion-based detail enhancement algorithm.  _Ultramicroscopy_ , 236:113499, 2022.  ISSN 0304-3991.
  * Thibault & Guizar-Sicairos (2012) Thibault, P. and Guizar-Sicairos, M.  Maximum-likelihood refinement for coherent diffractive imaging.  _New Journal of Physics_ , 14(6):063004, Jun 2012\.
  * Thibault et al. (2008) Thibault, P., Dierolf, M., Menzel, A., Bunk, O., David, C., and Pfeiffer, F.  High-resolution scanning x-ray diffraction microscopy.  _Science_ , 321(5887):379–382, 2008.
  * Van der Walt et al. (2014) Van der Walt, S., Schönberger, J. L., Nunez-Iglesias, J., Boulogne, F., Warner, J. D., Yager, N., Gouillart, E., and Yu, T.  scikit-image: image processing in python.  _PeerJ_ , 2:e453, 2014.
  * Wang et al. (2004) Wang, Z., Bovik, A., Sheikh, H., and Simoncelli, E.  Image quality assessment: from error visibility to structural similarity.  _IEEE Transactions on Image Processing_ , 13(4):600–612, 2004.
  * Xu et al. (2022) Xu, F., Liu, J., Song, Y., Sun, H., and Wang, X.  Multi-exposure image fusion techniques: A comprehensive review.  _Remote Sensing_ , 14(3), 2022.  ISSN 2072-4292.
  * Yin et al. (2015) Yin, Z., Su, H., Ker, E., Li, M., and Li, H.  Cell-sensitive phase contrast microscopy imaging by multiple exposures.  _Medical Image Analysis_ , 25(1):111–121, 2015\.  ISSN 1361-8415.
  * Zhang et al. (2016) Zhang, F., Chen, B., Morrison, G. R., Vila-Comamala, J., Guizar-Sicairos, M., and Robinson, I. K.  Phase retrieval by coherent modulation imaging.  _Nature Communications_ , 7(1):13367, Nov 2016\.  ISSN 2041-1723.
  * Zhang (2021) Zhang, X.  Benchmarking and comparing multi-exposure image fusion algorithms.  _Information Fusion_ , 74:111–131, 2021.  ISSN 1566-2535.

##  Appendix A Mathematical Notation

  * •

Iverson bracket:

$\llbracket A\rrbracket=\begin{cases}1,&\text{$A$ is true}\\\ 0,&\text{$A$ is
false}\end{cases}$

  * •

Expectation:

$\mathbb{E}[f]=\int f(x)\,p(x)\,dx$

is the expected value of quantity $f$ under the probability distribution $p$.
Special cases are the mean

$\mathbb{E}[x]=\int x\,p(x)\,dx$

and variance

$\text{var}[x]=\mathbb{E}\big{[}(x-\mathbb{E}[x])^{2}\big{]}=\mathbb{E}[x^{2}]-\left(\mathbb{E}[x]\right)^{2}\,.$

If $p(x\mid\theta)$ is a conditional probability distribution with
parameter(s) $\theta$, then the expectations depend on $\theta$ which we make
explicit by the following notation:

$\mathbb{E}[f\mid\theta]=\int f(x)\,p(x\mid\theta)\,dx$

  * •

“Follows”: The tilde symbol “$\sim$” indicates that a quantity $x$ follows a
particular probability distribution $p$:

$x\sim p(x)$

  * •

Parameters of the image model:

$\boldsymbol{q}$:

detector pixel coordinates

$t_{i}$:

camera acquisition times (with $i=1,\ldots,K$ where $K$ is the number of
acquisitions)

$n_{i}(\boldsymbol{q})$:

diffraction patterns acquired during $t_{i}$ for a given scan position

$b_{i}(\boldsymbol{q})$:

dark frame measurements acquired during $t_{i}$

$\mathcal{I}(\boldsymbol{q})$:

fused image / diffraction pattern

$w_{i}(\boldsymbol{q})$:

binary weight that is equal to $1$ for unsaturated pixels, $0$ otherwise

$c_{i}$:

flux rate associated with acquisition time $t_{i}$

  * •

Poisson distribution:

$\text{Poi}\left(n;\lambda\right)=\frac{\lambda^{n}}{n!}e^{-\lambda},\quad\lambda>0,\quad
n=0,1,2,\ldots$

with rate $\lambda$ for counts $n$.

  * •

$k$-truncated Poisson distribution:

$\text{TruncPoi}\left(n;\lambda,k\right)\propto\text{Poi}\left(n;\lambda\right)\,\llbracket
n>k\rrbracket$

This is a Poisson distribution with rate $\lambda$ where the counts are
$n=k+1,k+2,\ldots$. The normalization constant is:

$\sum_{n>k}\text{Poi}\left(n;\lambda\right)=1-\sum_{n\leq
k}\text{Poi}\left(n;\lambda\right)=1-e^{-\lambda}\sum_{n=0}^{k}\frac{\lambda^{n}}{n!}\,.$

  * •

Gamma distribution:

$\text{Gamma}\left(x;\alpha,\beta\right)=\frac{\beta^{\alpha}}{\Gamma(\alpha)}x^{\alpha-1}e^{-\beta
x},\quad x,\alpha,\beta\geq 0$

where $\Gamma(\cdot)$ is the Gamma function. The parameter $\alpha$ is the
shape parameter, $\beta$ is the rate parameter. The mean and variance of a
Gamma variable are:

$\mathbb{E}[x]=\frac{\alpha}{\beta},\quad\text{var}[x]=\frac{\alpha}{\beta^{2}}\,.$

  * •

Binomial distribution:

$\text{Binomial}(k;n,p)=\binom{n}{k}\,p^{k}\,(1-p)^{n-k}=\frac{n!}{k!(n-k)!}\,p^{k}\,(1-p)^{n-k}$

calculates the probability of getting exactly $k$ successes in $n$ trials
($k\leq n$) with a probability $p\in[0,1]$ of success in each trial. The
expected number of counts is

$\mathbb{E}[k]=p\,n\,.$

##  Appendix B Conventional multi-exposure image fusion

Photon counts on a detector can be assumed to follow a Poisson distribution.
Under the assumption of independent and identically distributed (i.i.d.)
counts, the likelihood of acquiring a diffraction pattern $n(\boldsymbol{q})$
given some true diffraction intensity $\mathcal{I}(\boldsymbol{q})$ is

$\Pr(n(\boldsymbol{q})\mid\mathcal{I}(\boldsymbol{q}))=\text{Poi}\left(n(\boldsymbol{q});\mathcal{I}(\boldsymbol{q})\right)=\frac{[\mathcal{I}(\boldsymbol{q})]^{n(\boldsymbol{q})}}{n(\boldsymbol{q})!}e^{-\mathcal{I}(\boldsymbol{q})}\,.$
(5)

In MEF, we measure diffraction patterns $n_{i}(\boldsymbol{q})$ by increasing
the optical intensity by some flux factor $c_{i}$ which is proportional to the
acquisition times $t_{i}$. Under the assumption that $c_{i}\approx t_{i}$, we
can rewrite the likelihood of observing $n_{i}(\boldsymbol{q})$ counts at
pixel $\boldsymbol{q}$ as

$\Pr(n_{i}(\boldsymbol{q})\mid\mathcal{I},c_{i})=\text{Poi}\left(n_{i}(\boldsymbol{q});c_{i}\mathcal{I}(\boldsymbol{q})\right)=\frac{[c_{i}\mathcal{I(\boldsymbol{q})}]^{n_{i}(\boldsymbol{q})}}{n_{i}(\boldsymbol{q})!}e^{-c_{i}\mathcal{I}(\boldsymbol{q})}\,.$
(6)

We will occasionally drop the pixel dependence $\boldsymbol{q}$ for
convenience. The log likelihood $\ell_{i}$ for the fused image $\mathcal{I}$
resulting from the $i$-th acquition can be written as

$\ell_{i}(\mathcal{I})=\displaystyle\sum_{\boldsymbol{q}}\big{\\{}n_{i}(\boldsymbol{q})\log[c_{i}\mathcal{I}(\boldsymbol{q})]-c_{i}\mathcal{I}(\boldsymbol{q})\big{\\}}\,.$
(7)

By incorporating only unsaturated pixels via the pixel-wise weight factor
$w_{i}(\boldsymbol{q})$, and summing over diffraction patterns
$n_{i}(\boldsymbol{q})$, the total log-likelihood becomes,

$\ell(\mathcal{I})=\displaystyle\sum_{i}\sum_{\boldsymbol{q}}\big{\\{}w_{i}(\boldsymbol{q})n_{i}(\boldsymbol{q})\log[c_{i}\mathcal{I}(\boldsymbol{q})]-w_{i}(\boldsymbol{q})c_{i}\mathcal{I}(\boldsymbol{q})\big{\\}}\,.$
(8)

The maximum likelihood estimate (MLE) of $\mathcal{I}$ is obtained by
maximizing the log likelihood:

$\mathcal{I}_{\text{MLE}}=\underset{\mathcal{I}}{\operatorname*{arg\,max}}\,\ell(\mathcal{I})\,.$

The MLE can be computed by setting the gradient of $\ell$ to zero:

$\frac{\partial\ell(\mathcal{I})}{\partial
I(\boldsymbol{q})}=\sum_{i}\frac{w_{i}(\boldsymbol{q})\,n_{i}(\boldsymbol{q})}{\mathcal{I}(\boldsymbol{q})}-\sum_{i}w_{i}(\boldsymbol{q})c_{i}\overset{!}{=}0\,.$

Solving this for $\mathcal{I}$ the fused MEF result is now given as

$\mathcal{I}_{\text{MLE}}(\boldsymbol{q})=\frac{\sum_{i}w_{i}(\boldsymbol{q})\,n_{i}(\boldsymbol{q})}{\sum_{i}w_{i}(\boldsymbol{q})\,c_{i}}\,.$

After subtracting the dark frame measurements $b_{i}(\boldsymbol{q})$ from the
diffraction patterns

$n_{i}^{+}(\boldsymbol{q}):=\max{\big{(}0,n_{i}(\boldsymbol{q})-b_{i}(\boldsymbol{q})\big{)}}\,,$

the conventional MEF result can be rewritten as

$\displaystyle\mathcal{I}_{\text{MLE}}(\boldsymbol{q})$
$\displaystyle=\frac{\sum_{i}w_{i}(\boldsymbol{q})\,n_{i}^{+}(\boldsymbol{q})}{\sum_{i}w_{i}(\boldsymbol{q})\,c_{i}},\quad
w_{i}(\boldsymbol{q})=\begin{cases}1,&\text{$\boldsymbol{q}$ is not
saturated}\\\ 0,&\text{$\boldsymbol{q}$ is saturated}\end{cases}$ (9)

by replacing the raw counts $n_{i}(\boldsymbol{q})$ with the background-
corrected counts $n_{i}^{+}(\boldsymbol{q})$.

##  Appendix C Bayesian multi-exposure image fusion

To derive Bayesian multi-exposure image fusion (MEF), we divide it in three
parts. The first part focuses on considering the Poisson likelihood and
deriving model parameters for fused data $\mathcal{I}(\boldsymbol{q})$ and
$c_{i}$. In the next subsection, we assume that the Poisson data is corrupted
with background, therefore modifying our likelihood to accommodate for this.
We derive the model parameters under this situation. In the last subsection,
we assume a right-(censored) Poisson distribution to model the saturated
pixels along with the consideration of the background data.

###  C.1 Poisson data

The likelihood of observing $n_{i}(\boldsymbol{q})$ at pixel $\boldsymbol{q}$
is defined in Eq. 6. The likelihood over the entire dataset can be given as

$\mathcal{L}(\mathcal{I},c)=\prod_{i}\prod_{\boldsymbol{q}}\left[c_{i}\mathcal{I}(\boldsymbol{q})\right]^{n_{i}(\boldsymbol{q})}e^{-c_{i}\mathcal{I}(\boldsymbol{q})}\,.$
(10)

We now define prior distributions. For $c_{i}$, we assume a Gamma distribution
as prior

$\Pr(c_{i}\mid\alpha_{i},\beta_{i})=\text{Gamma}\left(c_{i};\alpha_{i},\beta_{i}\right)=\frac{\beta_{i}^{\alpha_{i}}}{\Gamma(\alpha_{i})}\,c_{i}^{\alpha_{i}-1}e^{-\beta_{i}c_{i}}$
(11)

with the following properties

$\mathbb{E}[c_{i}]=\frac{\alpha_{i}}{\beta_{i}},\quad\text{var}[c_{i}]=\frac{\alpha_{i}}{\beta_{i}^{2}}\,.$
(12)

Similarly, our prior for $\mathcal{I}(\boldsymbol{q})$ is

$\Pr(\mathcal{I}(\boldsymbol{q})\mid\alpha_{\mathcal{I}},\beta_{\mathcal{I}})=\text{Gamma}\left(\mathcal{I}(\boldsymbol{q});\,\alpha_{\mathcal{I}},\beta_{\mathcal{I}}\right)=\frac{\beta_{\mathcal{I}}^{\alpha_{\mathcal{I}}}}{\Gamma(\alpha_{\mathcal{I}})}\left[\mathcal{I}(\boldsymbol{q})\right]^{\alpha_{\mathcal{I}}-1}e^{-\beta_{\mathcal{I}}\mathcal{I}(\boldsymbol{q})}$
(13)

The joint posterior is obtained by invoking Bayes’ rule:

$\Pr(\mathcal{I}(\boldsymbol{q}),c_{i}\mid
n_{i})\propto\Pr(n_{i}(\boldsymbol{q})\mid\mathcal{I}(\boldsymbol{q}),c_{i})\,\Pr(\mathcal{I}(\boldsymbol{q})\mid\alpha_{\mathcal{I}},\beta_{\mathcal{I}})\,\Pr(c_{i}\mid\alpha_{i},\beta_{i})$
(14)

where the dependence on the hyperparameters
$\alpha_{\mathcal{I}},\beta_{\mathcal{I}},\alpha_{i},\beta_{i}$ is omitted.
Due to the conjugacy property, the conditional posterior distributions for
$\mathcal{I}$ and $c_{i}$ will also be Gamma distributions. For
$\Pr(\mathcal{I},\mid c_{i},n_{i})$, we have

$\Pr(\mathcal{I}(\boldsymbol{q})\mid
c_{i},n_{i})=\text{Gamma}\left(\mathcal{I}(\boldsymbol{q});\,\alpha_{\mathcal{I}}+\sum_{i}n_{i}(\boldsymbol{q}),\beta_{\mathcal{I}}+\sum_{i}c_{i}\right)$
(15)

Similarly for $\Pr(c_{i}\mid\mathcal{I},n_{i})$, we have

$\Pr(c_{i}\mid\mathcal{I},n_{i})=\text{Gamma}\left(c_{i};\,\alpha_{i}+\sum_{\boldsymbol{q}}n_{i}(\boldsymbol{q}),\beta_{i}+\sum_{\boldsymbol{q}}\mathcal{I}(\boldsymbol{q})\right)$
(16)

Therefore, using the analytical expression for the expectation of the Gamma
distribution, the model parameters can be estimated as,

$\displaystyle\mathcal{I}^{(k+1)}(\boldsymbol{q})$
$\displaystyle=\mathbb{E}[\mathcal{I}(\boldsymbol{q})\mid
c_{i}^{(k)}]=\frac{\alpha_{\mathcal{I}}+\sum_{i}n_{i}(\boldsymbol{q})}{\beta_{\mathcal{I}}+\sum_{i}c_{i}^{(k)}}\,\,,$
(17) $\displaystyle c_{i}^{(k+1)}$
$\displaystyle=\mathbb{E}[c_{i}\mid\mathcal{I}^{(k+1)}]=\frac{\alpha_{i}+\sum_{\boldsymbol{q}}n_{i}(\boldsymbol{q})}{\beta_{i}+\sum_{\boldsymbol{q}}\mathcal{I}^{(k+1)}(\boldsymbol{q})}$

The expectation for a uniform Gamma prior of $\mathcal{I}(\boldsymbol{q})$ can
be given as $\alpha_{\mathcal{I}}/\beta_{\mathcal{I}}=1$. To achieve this, we
simply provide the same value for $\alpha_{\mathcal{I}}$ and
$\beta_{\mathcal{I}}$. Here, we choose both of these values to be $10^{-3}$,
which also avoids instability in the division. Since, we expect $c_{i}\approx
t_{i}$, the prior expectation is then given as $\alpha_{i}/\beta_{i}=t_{i}$.
For the special case of $\alpha_{i}=1$ which is the exponential distribution,
$\beta_{i}=t_{i}^{-1}$.

###  C.2 Poisson data with background

To account for the background or readout noise, we assume the Poisson rate
$c_{i}\mathcal{I}(\boldsymbol{q})$ is shifted by some background rate
$b_{i}(\boldsymbol{q})$

$n_{i}(\boldsymbol{q})\sim\text{Poi}\left(n_{i}(\boldsymbol{q});c_{i}\mathcal{I}(\boldsymbol{q})+b_{i}(\boldsymbol{q})\right)\,.$
(18)

The model can be interpreted as observing the sum of the latent unobserved
noisefree diffraction patterns $n_{\mathcal{I}i}(\boldsymbol{q})$ and
background counts $n_{bi}(\boldsymbol{q})$.

$\displaystyle\begin{split}&\text{Poi}\left(n_{i}(\boldsymbol{q});c_{i}\mathcal{I}(\boldsymbol{q})+b_{i}(\boldsymbol{q})\right)\\\
&=\displaystyle\sum_{n_{\mathcal{I}i}(\boldsymbol{q}),n_{bi}(\boldsymbol{q})=0}^{\infty}\llbracket
n_{i}(\boldsymbol{q})=n_{\mathcal{I}i}(\boldsymbol{q})+n_{bi}(\boldsymbol{q})\rrbracket\,\text{Poi}\left(n_{\mathcal{I}i}(\boldsymbol{q});c_{i}\mathcal{I}(\boldsymbol{q})\right)\text{Poi}\left(n_{bi}(\boldsymbol{q});b_{i}(\boldsymbol{q})\right)\,.\end{split}$
(19)

This follows from the binomial theorem as

$\displaystyle\sum_{k,l=0}^{\infty}\llbracket
s=k+l\rrbracket\,\text{Poi}\left(k;x\right)\,\text{Poi}\left(l;y\right)$
$\displaystyle=\sum_{k,l=0}^{\infty}\llbracket
s=k+l\rrbracket\,\frac{x^{k}}{k!}\,\frac{y^{l}}{l!}e^{-(x+y)}$
$\displaystyle=e^{-(x+y)}\sum_{k=0}^{s}\frac{x^{k}}{k!}\,\frac{y^{s-k}}{(s-k)!}$
$\displaystyle=\frac{e^{-(x+y)}}{s!}\sum_{k=0}^{s}\binom{s}{k}x^{k}\,y^{s-k}$
$\displaystyle=\frac{e^{-(x+y)}}{s!}(x+y)^{s}=\text{Poi}\left(s;x+y\right)$

To derive the conditional posterior of the latent counts, we note that the
distribution $n_{\mathcal{I}i}(\boldsymbol{q})$ given $n_{i}(\boldsymbol{q})$
is

$\Pr(n_{\mathcal{I}i}(\boldsymbol{q})\mid
n_{i}(\boldsymbol{q}),\mathcal{I}(\boldsymbol{q}),c_{i},b_{i}(\boldsymbol{q}))=\frac{\Pr(n_{i}(\boldsymbol{q}),n_{\mathcal{I}i}(\boldsymbol{q})\mid\mathcal{I}(\boldsymbol{q}),c_{i},b_{i}(\boldsymbol{q}))}{\Pr(n_{i}(\boldsymbol{q})\mid\mathcal{I}(\boldsymbol{q}),c_{i},b_{i}(\boldsymbol{q}))}$

We have for
$\Pr(n_{i}(\boldsymbol{q}),n_{\mathcal{I}i}(\boldsymbol{q})\mid\mathcal{I}(\boldsymbol{q}),c_{i},b_{i}(\boldsymbol{q}))$

$\displaystyle\Pr(n_{i},n_{\mathcal{I}i}\mid\mathcal{I},c_{i},b_{i})$
$\displaystyle=\sum_{n_{bi}=0}^{\infty}\llbracket
n_{i}=n_{\mathcal{I}i}+n_{bi}\rrbracket\,\text{Poi}\left(n_{\mathcal{I}i};c_{i}\mathcal{I}\right)\text{Poi}\left(n_{bi};b_{i}\right)$
(20)
$\displaystyle=\frac{e^{-(c_{i}\mathcal{I}+b_{i})}}{n_{i}!}\binom{n_{i}}{n_{\mathcal{I}i}}\left(c_{i}\mathcal{I}\right)^{n_{\mathcal{I}i}}b_{i}^{n_{i}-n_{\mathcal{I}i}},$

and
$\Pr(n_{i}(\boldsymbol{q})\mid\mathcal{I}(\boldsymbol{q}),c_{i},b_{i}(\boldsymbol{q}))$

$\Pr(n_{i}\mid\mathcal{I},c_{i},b_{i})=\text{Poi}\left(n_{i};c_{i}\mathcal{I}+b_{i}\right)=\frac{\left(c_{i}\mathcal{I}+b_{i}\right)^{n_{i}}}{n_{i}!}e^{-\left(c_{i}\mathcal{I}+b_{i}\right)}\,,$
(21)

From Eq. 20 and Eq. 21, it follows that

$\displaystyle\Pr(n_{\mathcal{I}i}\mid n_{i},\mathcal{I},c_{i},b_{i})$
$\displaystyle=\frac{e^{-(c_{i}\mathcal{I}+b_{i})}}{n_{i}!}\binom{n_{i}}{n_{\mathcal{I}i}}\left(c_{i}\mathcal{I}\right)^{n_{\mathcal{I}i}}b_{i}^{n_{i}-n_{\mathcal{I}i}}\biggl{/}\biggr{.}\frac{\left(c_{i}\mathcal{I}+b_{i}\right)^{n_{i}}}{n_{i}!}e^{-\left(c_{i}\mathcal{I}+b_{i}\right)}$
(22)
$\displaystyle=\binom{n_{i}}{n_{\mathcal{I}i}}\frac{\left(c_{i}\mathcal{I}\right)^{n_{\mathcal{I}i}}b_{i}^{n_{i}-n_{\mathcal{I}i}}}{(c_{i}\mathcal{I}+b_{i})^{n_{i}}}$
$\displaystyle=\text{Binomial}\left(n_{\mathcal{I}i};n_{i},\frac{c_{i}\mathcal{I}}{c_{i}\mathcal{I}+b_{i}}\right)$

We record the aggregate counts $n_{i}(\boldsymbol{q})$ and if we were to
measure dark frames $m_{ij}(\boldsymbol{q})$, i.e., repeat $J$ measurements
per acquisition, we can write it as

$m_{ij}(\boldsymbol{q})\sim\text{Poi}\left(\,\cdot\,;b_{i}(\boldsymbol{q})\right),\quad
j=1,\ldots,J$

We can assume the mean of the dark frames to be
$\overline{m}_{i}(\boldsymbol{q})\approx b_{i}(\boldsymbol{q})$ and therefore
the background rate $b_{i}(\boldsymbol{q})$ to be known for all acquisitions.
We can summarize all the conditional posterior distributions as

$\displaystyle\begin{split}\mathcal{I}(\boldsymbol{q})&\sim\text{Gamma}\left(\mathcal{I}(\boldsymbol{q});\,\alpha_{\mathcal{I}}+\sum_{i}n_{\mathcal{I}i}(\boldsymbol{q}),\beta_{\mathcal{I}}+\sum_{i}c_{i}\right)\\\
n_{\mathcal{I}i}(\boldsymbol{q})&\sim\text{Binomial}\left(n_{\mathcal{I}i}(\boldsymbol{q});n_{i}(\boldsymbol{q}),\frac{c_{i}\mathcal{I}(\boldsymbol{q})}{c_{i}\mathcal{I}(\boldsymbol{q})+b_{i}(\boldsymbol{q})}\right)\end{split}$
(23)

We can employ the expectation-maximization (EM) algorithm. In the expectation
step (E-step), we find the expectation of the latent quantity
$n_{\mathcal{I}i}(\boldsymbol{q})$. In the maximization step (M-step), we
maximize our estimation of the fused diffraction pattern
$\mathcal{I}(\boldsymbol{q})$.

$\displaystyle n_{\mathcal{I}i}^{(k+1)}(\boldsymbol{q})$
$\displaystyle=\mathbb{E}[n_{\mathcal{I}i}(\boldsymbol{q})\mid\mathcal{I}^{(k)}(\boldsymbol{q})]=\frac{c_{i}\mathcal{I}^{(k)}(\boldsymbol{q})}{c_{i}\mathcal{I}^{(k)}(\boldsymbol{q})+b_{i}(\boldsymbol{q})}\,n_{i}(\boldsymbol{q})$
(24) $\displaystyle\mathcal{I}^{(k+1)}(\boldsymbol{q})$
$\displaystyle=\mathbb{E}[\mathcal{I}(\boldsymbol{q})\mid
n_{\mathcal{I}i}^{(k+1)}(\boldsymbol{q})]=\frac{\alpha_{\mathcal{I}}+\sum_{i}n_{\mathcal{I}i}^{(k+1)}(\boldsymbol{q})}{\beta_{\mathcal{I}}+\sum_{i}c_{i}}$

###  C.3 Censored Poisson data with background

Now assume that the data are truncated at some censoring threshold ${n^{*}}$
such that the observed counts $n_{i}(\boldsymbol{q})$ are restricted to the
range $[0,{n^{*}}]$. These data can be modeled as unrestricted counts
$\nu_{i}(\boldsymbol{q})\in\mathbb{N}$

$\nu_{i}(\boldsymbol{q})\sim\text{Poi}\left(\,\cdot\,;c_{i}\mathcal{I}(\boldsymbol{q})+b_{i}(\boldsymbol{q})\right)$
(25)

that are only partially observed. If we knew all $\nu_{i}(\boldsymbol{q})$,
then the estimation of $\mathcal{I}(\boldsymbol{q})$ and $c_{i}$ could proceed
as in the previous section C.2. At saturated pixels (i.e. whenever
$\nu_{i}(\boldsymbol{q})\geq{n^{*}}$), the observed data are censored such
that the model for the actual observations $n_{i}(\boldsymbol{q})$ given
$\nu_{i}(\boldsymbol{q})$ is:

$n_{i}(\boldsymbol{q})=\begin{cases}\nu_{i}(\boldsymbol{q}),&\nu_{i}(\boldsymbol{q})<{n^{*}}\\\
{n^{*}},&\nu_{i}(\boldsymbol{q})\geq{n^{*}}\end{cases}\,.$ (26)

Since $\nu_{i}(\boldsymbol{q})$ are only partially observed, we estimate them
from $n_{i}(\boldsymbol{q})$ using their conditional posterior

$\nu_{i}(\boldsymbol{q})\sim\text{TruncPoi}\left(\,\cdot\,;c_{i}\mathcal{I}(\boldsymbol{q})+b_{i}(\boldsymbol{q}),{n^{*}}-1\right)$
(27)

when necessary, i.e. when $w_{i}(\boldsymbol{q})=0$ where the binary weight
$w_{i}(\boldsymbol{q})=\llbracket n_{i}(\boldsymbol{q})<{n^{*}}\rrbracket$
indicates if a pixel is not saturated (when $w_{i}(\boldsymbol{q})=1$, we just
let $\nu_{i}(\boldsymbol{q})=n_{i}(\boldsymbol{q})$). Here, we introduced the
truncated Poisson distribution
$\text{TruncPoi}\left(\nu_{i}(\boldsymbol{q});c_{i}\mathcal{I}(\boldsymbol{q})+b_{i}(\boldsymbol{q}),{n^{*}}-1\right)$
that corresponds to the unobserved right tail of the Poisson distribution
$\text{Poi}\left(\nu_{i}(\boldsymbol{q});c_{i}\mathcal{I}(\boldsymbol{q})+b_{i}(\boldsymbol{q})\right)$.
The $k$-truncated Poisson distribution is defined as

$\text{TruncPoi}\left(n;\lambda,k\right)=\frac{\text{Poi}\left(n;\lambda\right)}{1-\sum_{j=0}^{k}\text{Poi}\left(j;\lambda\right)}=\frac{1}{n!}\,\frac{\lambda^{n}e^{-\lambda}}{1-e^{-\lambda}\sum_{j=0}^{k}\lambda^{j}/j!}$
(28)

for $n=k+1,k+2,\ldots$ The expected number of counts under the truncated
Poisson distribution is

$\displaystyle\mathbb{E}[n\mid\lambda,k]$ $\displaystyle=\sum_{n\geq
0}n\,\text{TruncPoi}\left(n;\lambda,k\right)=\sum_{n\geq
k+1}n\,\frac{\lambda^{n}e^{-\lambda}/n!}{1-e^{-\lambda}\sum_{m=0}^{k}\lambda^{m}/m!}=\frac{\sum_{n\geq
k+1}n\lambda^{n}e^{-\lambda}/n!}{1-e^{-\lambda}\sum_{m=0}^{k}\lambda^{m}/m!}$
(29) $\displaystyle=\frac{\lambda\sum_{n\geq
k+1}\lambda^{n-1}e^{-\lambda}/(n-1)!}{1-e^{-\lambda}\sum_{m=0}^{k}\lambda^{m}/m!}=\lambda\frac{\sum_{n\geq
k}\lambda^{n}e^{-\lambda}/n!}{1-e^{-\lambda}\sum_{m=0}^{k}\lambda^{m}/m!}=\lambda\,\frac{1-e^{-\lambda}\sum_{n=0}^{k-1}\lambda^{n}/n!}{1-e^{-\lambda}\sum_{m=0}^{k}\lambda^{m}/m!}\,.$

We estimate the unobserved counts $\nu_{i}(\boldsymbol{q})$ for
$w_{i}(\boldsymbol{q})=0$ by computing their expected value given the current
estimate of the rate $c_{i}\mathcal{I}(\boldsymbol{q})+b_{i}(\boldsymbol{q})$.
Therefore, the expectation of the latent counts $\nu_{i}(\boldsymbol{q})$ can
be written as

$\displaystyle\begin{split}&\mathbb{E}\left[\nu_{i}(\boldsymbol{q})\mid
c_{i}\mathcal{I}(\boldsymbol{q})+b_{i}(\boldsymbol{q}),{n^{*}}-1\right]\\\
&=\left(c_{i}\mathcal{I}(\boldsymbol{q})+b_{i}(\boldsymbol{q})\right)\,\frac{1-e^{-\left(c_{i}\mathcal{I}(\boldsymbol{q})+b_{i}(\boldsymbol{q})\right)}\sum_{m=0}^{{n^{*}}-2}[c_{i}\mathcal{I}(\boldsymbol{q})+b_{i}(\boldsymbol{q})]^{m}/m!}{1-e^{-\left(c_{i}\mathcal{I}(\boldsymbol{q})+b_{i}(\boldsymbol{q})\right)}\sum_{m=0}^{{n^{*}}-1}[c_{i}\mathcal{I}(\boldsymbol{q})+b_{i}(\boldsymbol{q})]^{m}/m!}\end{split}$
(30)

The expectation maximization (EM) algorithm is now employed to estimate the
expectation of our incomplete data and maximize for the fused result
$\mathcal{I}(\boldsymbol{q})$. The expectation step (E-step) can be summarized
as

$\nu_{i}^{(k+1)}(\boldsymbol{q})=\begin{cases}\mathbb{E}[\nu_{i}(\boldsymbol{q})\mid
c_{i}\mathcal{I}^{(k)}(\boldsymbol{q})+b_{i}(\boldsymbol{q}),{n^{*}}-1],&w_{i}(\boldsymbol{q})=0\\\
n_{i}(\boldsymbol{q}),&w_{i}(\boldsymbol{q})=1\\\ \end{cases}$ (31)

The expectation also includes the estimation of complete noisefree counts
$\nu_{\mathcal{I}i}$ similar to the estimate of $n_{\mathcal{I}i}$ from Eq.
24:

$\nu_{\mathcal{I}i}^{(k+1)}(\boldsymbol{q})=\frac{c_{i}\mathcal{I}^{(k)}(\boldsymbol{q})}{c_{i}\mathcal{I}^{(k)}(\boldsymbol{q})+b_{i}(\boldsymbol{q})}\,\nu_{i}^{(k+1)}(\boldsymbol{q})$
(32)

By assuming Gamma prior $\Pr(\mathcal{I}(\boldsymbol{q}))$ from Eq. 13, we can
maximize the log posterior with respect to $\mathcal{I}(\boldsymbol{q})$. The
maximization step based on noisefree counts estimates
$\mathcal{I}(\boldsymbol{q})$ as

$\displaystyle\mathcal{I}^{(k+1)}(\boldsymbol{q})=\frac{\alpha_{\mathcal{I}}+\displaystyle\sum_{i}\nu_{\mathcal{I}i}^{(k+1)}(\boldsymbol{q})}{\beta_{\mathcal{I}}+\displaystyle\sum_{i}c_{i}}\,.$
(33)

The full EM algorithm can now be summarized with Eq. 17 and Eq. 33 as

$\displaystyle\nu_{\mathcal{I}i}^{(k+1)}(\boldsymbol{q})$
$\displaystyle=\frac{c_{i}^{(k)}\mathcal{I}^{(k)}(\boldsymbol{q})}{c_{i}^{(k)}\mathcal{I}^{(k)}(\boldsymbol{q})+b_{i}(\boldsymbol{q})}\left(w_{i}(\boldsymbol{q})n_{i}(\boldsymbol{q})+\left(1-w_{i}(\boldsymbol{q})\right)\,\mathbb{E}[\nu_{i}(\boldsymbol{q})|c_{i}^{(k)}\mathcal{I}^{(k)}(\boldsymbol{q})+b_{i}(\boldsymbol{q}),{n^{*}}-1]\right)$
(34) $\displaystyle c_{i}^{(k+1)}$
$\displaystyle=\frac{\alpha_{i}+\sum_{\boldsymbol{q}}\nu_{\mathcal{I}i}^{(k+1)}(\boldsymbol{q})}{\beta_{i}+\sum_{\boldsymbol{q}}\mathcal{I}^{(k)}(\boldsymbol{q})}$
$\displaystyle\mathcal{I}^{(k+1)}(\boldsymbol{q})$
$\displaystyle=\frac{\alpha_{\mathcal{I}}+\sum_{i}\nu_{\mathcal{I}i}^{(k+1)}(\boldsymbol{q})}{\beta_{\mathcal{I}}+\sum_{i}c_{i}^{(k+1)}}$

##  Appendix D Synthetic data

The section consists of additional details about the SNR of weakly scattering
specimens and the structural similarity index (SSIM).

###  D.1 Weak phase object

A weak phase object can be represented by a superposition of weak phase
gratings using Fourier analysis. For a simple weak phase grating,

$t(x)=\exp\big{(}2\,i\,\rho\cos(2\pi f_{0}x)\big{)}$ (35)

where, $\rho\ll 1$ is a small constant, $f_{0}$ is a fixed frequency with $x$
being the spatial coordinate. The Taylor expansion of this becomes,

$\displaystyle t(x)$ $\displaystyle\approx 1+2i\rho\cdot\cos(2\pi
f_{0}x)+\dots$ (36) $\displaystyle=1+i\rho\cdot\big{(}e^{i2\pi
f_{0}x}+e^{-i2\pi f_{0}x}\big{)}$

Fourier transform $T(f)=\mathcal{F}\big{(}t(x)\big{)}$ can be given as

$\displaystyle
T(f)=\delta(f)+i\rho\big{(}\delta(f_{0}-f)+\delta(f_{0}+f)\big{)}$ (37)

where, $\delta(f)$ is a delta function. In ptychography, the exit wave is
given as

$e(x)=t(x)\cdot p(x)$ (38)

where $p(x)$ is the probe. Far-field diffraction pattern records Fourier
transformed signal which is the convolution between the object and probe in
the reciprocal space. This is given as

$E(f)=T(f)\circledast P(f)$ (39)

Now plugging Eq. 37 in Eq. 39, we can rewrite this as

$\displaystyle E(f)$
$\displaystyle=\bigg{(}\delta(f)+i\rho\big{(}\delta(f_{0}-f)+\delta(f_{0}+f)\big{)}\bigg{)}\circledast
P(f)$ (40) $\displaystyle=P(f)+i\rho\big{(}P(f_{0}-f)+P(f_{0}+f)\big{)}$

The measured intensity $I(f)=|E(f)|^{2}$. We can now write simplified $I(f)$
as

$I(f)\approx|P(f)|^{2}+\rho^{2}\big{|}P(f_{0}-f)+P(f_{0}+f)\big{|}^{2}$ (41)

Here, $|P(f)|^{2}$ corresponds to the empty probe beam or ballistic
(unscattered) photons as recorded on the detector. Poisson noise is mainly
driver by the probe. The second term depends on the object quality which is
the phase grating modulation $\rho$. If $C=P(f)$, we can say,

$\displaystyle I_{ballistic}$ $\displaystyle=C^{2}$ (42) $\displaystyle
I_{scattered}$ $\displaystyle=\rho^{2}C^{2}$

The noise in the CMOS sensor scales as the square root of the signal
$\sqrt{I_{ballistic}}$. Therefore, the Signal-to-noise ratio (SNR) can now be
given as,

SNR $\displaystyle=\frac{I_{scattered}}{\sqrt{I_{ballistic}}}$ (43)
$\displaystyle=\rho^{2}C$

So, in general, SNR scales with the phase modulation term $\rho^{2}$ of the
specimen and the total signal strength $C$. Therefore, a small value of
$\rho$, i.e., a weak scattering specimen, leads to a poor SNR. In general, a
weak phase object $t(x)$ can be given as

$t(x)=\exp(i\phi)\approx 1+i\phi$ (44)

where $\rho=\max\big{(}\phi(x)\big{)}$

###  D.2 Structural Similarity index

Structural Similarity (SSIM) index (Wang et al., 2004) is defined between
windows (spatial patches of the same size) x from a reference image X and y
from a test image Y as

$\text{SSIM}(\textbf{x},\textbf{y})=\frac{(2\mu_{x}\mu_{y}+C_{1})(2\sigma_{xy}+C_{2})}{(\mu_{x}^{2}+\mu_{y}^{2}+C_{1})(\sigma_{x}^{2}+\sigma_{y}^{2}+C_{2})}$
(45)

This gives us an estimate of local statistics within the window. In this
paper, we use a $9\times 9$ window using a circular symmetric Gaussian
weighting function $\textbf{w}=\\{w_{i}|i=1,2,...,N\\}$ with the standard
deviation of $1.0$, normalized to unit sum $(\sum_{i=1}^{N}w_{i}=1)$. The
estimates of $\mu_{x}$ and $\sigma_{x}^{2}$ are therefore given as weighted
mean and weighted variance respectively.

$\displaystyle\mu_{x}$ $\displaystyle=\sum_{i=1}^{N}w_{i}x_{i}$ (46)
$\displaystyle\sigma_{x}^{2}$
$\displaystyle=\sum_{i=1}^{N}w_{i}(x_{i}-\mu_{x})^{2}$

This is similar for $\mu_{y}$ and $\sigma_{y}^{2}$. The weighted covariance
$\sigma_{xy}$ is given as

$\sigma_{xy}=\sum_{i=1}^{N}w_{i}(x_{i}-\mu_{x})(y_{i}-\mu_{y})$ (47)

$C_{1}=(K_{1}L)^{2}$ and $C_{2}=(K_{2}L)^{2}$ are constants that avoid
instability when either $(\mu_{x}^{2}+\mu_{y}^{2})$ or
$(\sigma_{x}^{2}+\sigma_{y}^{2})$ approach zero. $L$ is the dynamic range a
pixel value can take which is set to be the difference between the maximum and
minimum value from our reference and test image
$L=\max(\textbf{X},\textbf{Y})-\min(\textbf{X},\textbf{Y})$. As per the
recommendation of the original publication from Wang et al., (Wang et al.,
2004) we set the values of $K_{1}=0.01$ and $K_{2}=0.03$. Although these
values are somewhat arbitrary, the variations in these values are insensitive
to the performance of the SSIM index. If there are $M$ windows that cover our
entire image X or Y, a moving window average of SSIM is evaluated called the
mean SSIM (MSSIM).

$\text{MSSIM}(\textbf{X},\textbf{Y})=\frac{1}{M}\sum_{j=1}^{M}\text{SSIM}(\textbf{x}_{j},\textbf{y}_{j})$
(48)

For our synthetic data tests, we evaluate MSSIM between ground truth and
results from the Bayesian and conventional MEF methods. It is evaluated for
just the phase values from the complex-valued ptychographic reconstructions as
we simulate a weak phase object. MSSIM metric was utilized with its
implementation from the package scikit-image (Van der Walt et al., 2014).

Figure 5: Every row corresponds to synthetic data (log-scale) with
ptychographic reconstruction results for scattering parameter $\rho$. The
diffraction patterns recorded at varying flux factors $c_{i}$ are fused with
conventional and Bayesian MEF methods and the ptychographic reconstruction
results are compared with the ground truth.

##  Appendix E Experimental design

Figure 6 (a) depicts the setup used in this experiment. A coherent light
source is generated with the supercontinuum laser (SuperK COMPACT, NKT
Photonics) capable of emitting wavelength in a wide range from $450\,nm$ to
$2400\,nm$ with a variable repetition rate of $1\,Hz$ to $20\,kHz$. An
acousto-optic tunable filter (AOTF) allows wavelength selection with a
bandwidth of $2.5\,nm$ to $8.5\,nm$ from a spectrum of $450\,nm$ to $625\,nm$.
For this experiment, we select a wavelength of $625\,nm$ with lens $L1=30\,mm$
and $L2=100\,mm$ used for beam expansion. The beam passes through the fixed
pinhole of $400\,\mu m$ which specifies the size of the probe for scanning the
specimen. Lens $L3=30\,mm$ images the pinhole onto the specimen. The specimen
is mounted on the SmartAct positioner with stages CLS-3232-D-S allowing three
degrees of freedom (X, Y, Z direction) driven by a piezo drive. The Z
direction is fixed, and the ptychographic scanning is done by moving the
specimen in the XY plane. Diffraction patterns are recorded for each scan
position with the CMOS camera from Lucid (Phoenix 20 MP Model) with a
resolution of $5472\times 3648\,px$, pixel size of $2.4\,\mu m\times 2.4\,\mu
m$ and a $12$ bit analog-to-digital (ADC) converter.

Figure 6: (a) Experimental ptychography setup in transmission geometry. (b)
Probe beam of size $400\,\mu m$ characterized with ptychographic
reconstruction. (c) Concentric scanning grid used in the experiment.

In this experiment, we use the unstained histological mouse section as our
object. The ptychography experiment is designed by deciding the object-
detector distance to be $23.7\,mm$ and a binning of factor $8$ that
effectively reduces the resolution to $684\times 456$. The probe field of view
(FOV) can then be calculated to be $\approx 771.4\,\mu m$. Based on the
theoretical consideration for the probe to be approximately half of the probe
field of view, a pinhole of size $400\,\mu m$ ensures that (see Fig. 6 (b)).
We select $500$ scan positions for a concentric spiral scan grid with the
radius of $1.009\,mm$ as shown in figure 6 (c) and the probe overlap between
adjacent scan positions is $80\,\%$. Therefore, we can reconstruct an area of
$\approx 3.2\,mm^{2}$ from our mouse specimen.


# Numerical semigroups with a fixed number of gaps of second kind

Aureliano M. Robles-Pérez  and José Carlos Rosales∗ Both authors are supported
by the project MTM2017-84890-P (funded by Ministerio de Economía, Industria y
Competitividad and Fondo Europeo de Desarrollo Regional FEDER) and by the
Junta de Andalucía Grant Number FQM-343.Departamento de Matemática Aplicada,
Universidad de Granada, 18071-Granada, Spain.
E-mail<EMAIL_ADDRESS>de Álgebra, Universidad de Granada,
18071-Granada, Spain.
E-mail<EMAIL_ADDRESS>
###### Abstract

We study the numerical semigroups in function of their gaps of second kind.
Moreover, fixed two non-negative integers $F$ and $K$, we give an algorithm to
compute all the numerical semigroups whose Frobenius number is $F$ and that
have $K$ gaps of second kind.

Keywords: Irreducible numerical semigroups, gaps of first kind, gaps of second
kind, Frobenius number.

2010 AMS Classification: 20M14, 11Y16.

##  1 Introduction

Let ${\mathbb{Z}}$ and ${\mathbb{N}}$ be the set of integers and the set of
nonnegative integers respectively. A _numerical semigroup_ is a subset $S$ of
${\mathbb{N}}$ which is closed under addition, $0\in S$ and
${\mathbb{N}}\setminus S$ is finite. The _Frobenius number_ of $S$, denoted by
$\mathrm{F}(S)$, is the maximum integer that does not belong to $S$. The
elements of ${\mathbb{N}}\setminus S$ are called the _gaps_ of $S$, and its
cardinality, denoted by $\mathrm{g}(S)$, is the _genus_ of $S$.

Let $S$ be a numerical semigroup. We denote by $\mathrm{N}(S)=\\{s\in S\mid
s<\mathrm{F}(S)\\}$ (whose elements are known as _small elements_ of $S$). It
is clear that the sets $\mathrm{H}(S)=\\{\mathrm{F}(S)-s\mid
s\in\mathrm{N}(S)\\}$ and $\mathrm{L}(S)=\\{x\in{\mathbb{N}}\setminus
S\mid\mathrm{F}(S)-x\notin\mathrm{N}(S)\\}$ are subsets of
${\mathbb{N}}\setminus S$ and, in addition,
${\mathbb{N}}=S\mathbin{\mathaccent
0{\cdot}\cup}\mathrm{H}(S)\mathbin{\mathaccent 0{\cdot}\cup}\mathrm{L}(S)$
(that is, disjoint union). Following the notation in [6] (see also [2]), the
elements of $\mathrm{H}(S)$ and $\mathrm{L}(S)$ are the _gaps of first and
second kind_ of $S$, respectively. On the other hand, we denote by
$\mathrm{n}(S)$ and $\mathrm{l}(S)$ the cardinality of $\mathrm{N}(S)$ and
$\mathrm{L}(S)$, respectively.

Let $l\in{\mathbb{N}}$. We say that a numerical semigroup $S$ is an
$l$-semigroup if $\mathrm{l}(S)=l$. Our main purpose in this work will be to
give an algorithm which enables us to build all the $l$-semigroups with a
fixed Frobenius number.

Let us summarize the content of this work. In Section 2 we will see that the
concept of $0$-semigroup ($1$-semigroup respectively) coincides with the
concept of symmetric numerical semigroup (pseudo-symmetric respectively). Let
us remember that these semigroups are of great interest and have been widely
studied (for instance, see [7] and [1]). Moreover, as it is shown in [12],
they are a partition of the family of irreducible numerical semigroups.

In Section 3 we will relate the $2$-semigroups ($3$-semigroups respectively)
with the URSY-semigroups (URPSY-semigroups respectively), which were studied
in [10] ([9] respectively). This study will enable us to obtain the pseudo-
Frobenius numbers of the $2$-semigroups and $3$-semigroups.

Recall that, if $S$ is a numerical semigroup, then the _pseudo-Frobenius
numbers_ of $S$ are the elements of
$\mathrm{PF}(S)=\big{\\{}x\in{\mathbb{Z}}\setminus S\mid x+s\in S\mbox{ for
all }s\in S\setminus\\{0\\}\big{\\}}$ (see [11]). Moreover, the cardinality of
$\mathrm{PF}(S)$ is the _type_ of $S$ (see [5]).

In Section 4 we will prove that, if $l$ is even (odd, respectively), then any
$l$-semigroup with Frobenius number $F$ can be obtained from a symmetric
(pseudo-symmetric, respectively) numerical semigroup with Frobenius number $F$
after removing $\frac{l}{2}$ ($\frac{l-1}{2}$, respectively) elements greater
than $\frac{F}{2}$ and less than $F$.

Finally, in Section 5, we will show an algorithm that enables us to compute
all the $l$-semigroups with a fixed Frobenius number.

We end this introduction by showing that, in numerical semigroups, the
connection between gaps of first kind and gaps of second kind is of great
interest. Firstly, let us recall that, if $A$ is a non-empty subset of
${\mathbb{N}}$, then we denote by $\langle A\rangle$ the submonoid of
$({\mathbb{N}},+)$ generated by $A$, that is,

$\langle A\rangle=\big{\\{}\lambda_{1}a_{1}+\cdots+\lambda_{n}a_{n}\mid
n\in{\mathbb{N}}\setminus\\{0\\},\ a_{1},\ldots,a_{n}\in A,\
\lambda_{1},\ldots,\lambda_{n}\in{\mathbb{N}}\big{\\}}.$

It is well known that $\langle A\rangle$ is a numerical semigroup if and only
if $\gcd(A)=1$. On the other hand, if $S$ is a numerical semigroup and
$S=\langle A\rangle$, then we say that $A$ is a _system of generators_ of $S$.
In addition, if $S\not=\langle B\rangle$ for any subset $B\subsetneq A$, then
we say that $A$ is a _minimal system of generators_ of $S$. In [13] it is
shown that each numerical semigroup has a unique minimal system of generators
and that such a system is finite. We denote by $\mathrm{msg}(S)$ the minimal
system of generators of $S$ and by $\mathrm{e}(S)$ the cardinality of
$\mathrm{msg}(S)$, that is called the _embedding dimension_ of $S$.

In [15] it was conjectured that, if $S$ is a numerical semigroup, then we have
that $\mathrm{g}(S)\leq\big{(}\mathrm{e}(S)-1\big{)}\mathrm{n}(S)$. At
present, and in general, this conjecture is open and its resolution is one of
the most important problems in this theory. On the other hand, having in mind
that $\mathrm{g}(S)=\mathrm{n}(S)+\mathrm{l}(S)$, then we can rewrite the
conjecture in terms of the number of gaps of first and second kind. Namely,
$\mathrm{l}(S)\leq(\mathrm{e}(S)-2)\mathrm{n}(S)$.

##  2 0-semigroups and 1-semigroups

A numerical semigroup $S$ is _irreducible_ if it can not be expressed as the
intersection of two numerical semigroups which contain $S$ properly. This
concept was introduced in [12], where it is shown that a numerical semigroup
$S$ is irreducible if and only if $S$ is maximal (with respect the set
inclusion) in the set of numerical semigroups with Frobenius number equals to
$\mathrm{F}(S)$. From the results in [1] and [5], it is deduced in [12] that
the family of irreducible numerical semigroups is just the union of two well
known families, namely the symmetric and the pseudo-symmetric numerical
semigroups. Moreover, a numerical semigroup is symmetric (pseudo-symmetric,
respectively) if it is irreducible and its Frobenius number is odd (even,
respectively).

The following result is Corollary 4.5 of [13].

######  Lemma 2.1.

Let $S$ be a numerical semigroup.

  1. 1.

$S$ is symmetric if and only if $\mathrm{g}(S)=\frac{\mathrm{F}(S)+1}{2}$.

  2. 2.

$S$ is pseudo-symmetric if and only if
$\mathrm{g}(S)=\frac{\mathrm{F}(S)+2}{2}$.

The next result has an easy proof and, therefore, we omit it.

######  Lemma 2.2.

If $S$ is a numerical semigroup, then

  1. 1.

$\mathrm{g}(S)+\mathrm{n}(S)=\mathrm{F}(S)+1$;

  2. 2.

$\mathrm{g}(S)=\mathrm{n}(S)+\mathrm{l}(S)$;

  3. 3.

$\mathrm{g}(S)=\frac{\mathrm{F}(S)+1+\mathrm{l}(S)}{2}$.

And, as a direct consequence of Lemmas 2.1 and 2.2, we have the following
result.

######  Proposition 2.3.

If $S$ is a numerical semigroup, then

  1. 1.

$S$ is symmetric if and only if $\,\mathrm{l}(S)=0$;

  2. 2.

$S$ is pseudo-symmetric if and only if $\,\mathrm{l}(S)=1$.

The next result is consequence of Corollaries 4.11 and 4.16 of [13].

######  Lemma 2.4.

Let $S$ be a numerical semigroup.

  * a)

The following conditions are equivalents.

    * a.1)

$S$ is symmetric.

    * a.2)

$\mathrm{PF}(S)=\\{\mathrm{F}(S)\\}$.

    * a.3)

$\mathrm{t}(S)=1$.

  * b)

$S$ is pseudo-symmetric if and only if
$\mathrm{PF}(S)=\left\\{\mathrm{F}(S),\frac{\mathrm{F}(S)}{2}\right\\}$.

As an immediate consequence of Proposition 2.3 and Lemma 2.4, we have the next
result.

######  Corollary 2.5.

Let $S$ be a numerical semigroup.

  1. 1.

$\mathrm{l}(S)=0$ if and only if $\mathrm{PF}(S)=\\{\mathrm{F}(S)\\}$.

  2. 2.

$\mathrm{l}(S)=1$ if and only if
$\mathrm{PF}(S)=\left\\{\mathrm{F}(S),\frac{\mathrm{F}(S)}{2}\right\\}$.

##  3 2-semigroups and 3-semigroups

We begin this section studying the numerical semigroups $S$ such that
$\mathrm{l}(S)=2$. For that we need to introduce several concepts and results.

If $F$ is a positive integer, the we denote by $\mathcal{L}(F)$ the set of all
the numerical semigroups with Frobenius number $F$.

The following result is deduced from [5] (or from Lemmas 4 and 5 in [3]).

######  Lemma 3.1.

Let $S$ be a numerical semigroup with Frobenius number $F$.

  1. 1.

$S$ is irreducible if and only if $S$ is maximal in $\mathcal{L}(F)$.

  2. 2.

If $\,h=\max\left\\{x\in{\mathbb{N}}\setminus
S\,\big{|}\,F-x\in{\mathbb{N}}\setminus S,\ x\not=\frac{F}{2}\right\\}$, then
$S\cup\\{h\\}\in\mathcal{L}(F)$.

  3. 3.

$S$ is irreducible if and only if $\left\\{x\in{\mathbb{N}}\setminus
S\,\big{|}\,F-x\in{\mathbb{N}}\setminus S,\
x\not=\frac{F}{2}\right\\}=\emptyset$.

  4. 4.

$S\cup\left\\{x\in{\mathbb{N}}\setminus
S\,\big{|}\,F-x\in{\mathbb{N}}\setminus S,\ x>\frac{F}{2}\right\\}$ is a
numerical semigroup that is irreducible and with Frobenius number $F$.

The next result has an immediate proof.

######  Lemma 3.2.

Let $S$ be a numerical semigroup and $x\in S$. Then $S\setminus\\{x\\}$ is a
numerical semigroup if and only if $x\in\mathrm{msg}(S)$.

Now, from Lemma 2.2 we deduce the following one.

######  Lemma 3.3.

Let $S$ be a numerical semigroup and $x\in\mathrm{msg}(S)$ such that
$x<\mathrm{F}(S)$. Then $\mathrm{l}(S\setminus\\{x\\})=\mathrm{l}(S)+2$.

Let $S$ be a numerical semigroup with $\mathrm{l}(S)\geq 2$. Then, from
Proposition 2.3, we know that $S$ is not irreducible. Moreover, from Lemma
3.1, there exists $\mathrm{h}(S)=\max\left\\{x\in{\mathbb{N}}\setminus
S\,\big{|}\,F-x\in{\mathbb{N}}\setminus S,\
x\not=\frac{F}{2}\right\\}=\max\big{(}\mathrm{L}(S)\big{)}$ and
$S\cup\\{\mathrm{h}(S)\\}$ is a numerical semigroup. In addition, it is clear
that $\mathrm{h}(S)$ is a minimal generator of $S\cup\\{\mathrm{h}(S)\\}$
which is less than $\mathrm{F}(S\cup\\{\mathrm{h}(S)\\})$. Thereby, by
applying Lemma 3.3, we have the next result.

######  Lemma 3.4.

If $S\in\mathcal{L}(F)$ and $\,\mathrm{l}(S)\geq 2$, then
$\mathrm{l}(S\cup\\{\mathrm{h}(S)\\})=\mathrm{l}(S)-2$.

In the following result we show how to obtain all the $l$-semigroups when we
know the $(l-2)$-semigroups set.

######  Proposition 3.5.

If $S\in\mathcal{L}(F)$, then the following conditions are equivalent.

  1. 1.

$\mathrm{l}(S)=l$ and $\,l\geq 2$.

  2. 2.

There exist $\,T\in\mathcal{L}(F)$ and $x\in\mathrm{msg}(T)$ such that
$\,\mathrm{l}(T)=l-2$, $\frac{F}{2}<x<F$, and $S=T\setminus\\{x\\}$.

###### Proof.

(1. $\Rightarrow$ 2.) Since $l\geq 2$, then there exists $\mathrm{h}(S)$.
Therefore, $T=S\cup\\{\mathrm{h}(S)\\}\in\mathcal{L}(F)$ and $\mathrm{h}(S)$
is a minimal generator of $T$ such that $\frac{F}{2}<\mathrm{h}(S)<F$.
Moreover, from Lemma 3.4, $\mathrm{l}(T)=\mathrm{l}(S)-2$. In order to finish
the proof, it is enough to observe that $S=T\setminus\\{\mathrm{h}(S)\\}$.

(2. $\Rightarrow$ 1.) This implication is an immediate consequence of Lemma
3.3. ∎

Let us observe that, as a consequence of Lemma 3.3 and Propositions 2.3 and
3.5, if $Q$ is a numerical semigroup with $\mathrm{l}(Q)=2$, then there exist
a symmetric numerical semigroup $P$ and $x\in\mathrm{msg}(P)$ such that
$x<\mathrm{F}(P)$ and $Q=P\setminus\\{x\\}$. Now, using the study about URSY-
semigroups made in [10], we will obtain information about the pseudo-Frobenius
numbers of a $2$-semigroup.

Recalling that a numerical semigroup $S$ is an _URSY-semigroup_ if there exist
a symmetric numerical semigroup $T$ and $x\in\mathrm{msg}(T)$ such that
$S=T\setminus\\{x\\}$, then we can assert that every $2$-semigroup is an URSY-
semigroup. However, the contrary one is not true. For example, $\langle
2,5\rangle\setminus\\{5\\}=\langle 2,7\rangle$ is an URSY-semigroup and
$\mathrm{l}(\langle 2,7\rangle)=0$.

The next result can be easily deduced from Theorem 2.2 of [10]. Recall that,
if $S$ is a numerical semigroup, then $\mathrm{m}(S)=\min(S\setminus\\{0\\})$
is known as the _multiplicity_ of $S$.

######  Proposition 3.6.

Let $S$ be a numerical semigroup. Then $\mathrm{l}(S)=2$ if and only if $S$ is
an URSY-semigroup and $\mathrm{m}(S)\geq 3$.

The following result is obtained from Lemmas 2.3 and 2.7 of [10] and the proof
of Proposition 3.5.

######  Proposition 3.7.

If $S$ is a $2$-semigroup, then

$\left\\{\mathrm{F}(S),\mathrm{h}(S)\right\\}\subseteq\mathrm{PF}(S)\subseteq\\{\mathrm{F}(S),\mathrm{h}(S),\mathrm{F}(S)-\mathrm{h}(S)\\}.$

Moreover, $\mathrm{F}(S)-\mathrm{h}(S)\in\mathrm{PF}(S)$ if and only if
$\,2\mathrm{h}(S)-\mathrm{F}(S)\notin S$.

An immediate consequence of the above Proposition is the next result.

######  Corollary 3.8.

If $S$ is a $2$-semigroup, then $\mathrm{t}(S)\in\\{2,3\\}$. Moreover,
$\mathrm{t}(S)=2$ (that is,
$\mathrm{PF}(S)=\\{\mathrm{F}(S),\mathrm{h}(S)\\}$) if and only if
$\,2\mathrm{h}(S)-\mathrm{F}(S)\in S$.

Let us illustrate the previous results with an example.

######  Example 3.9.

From Lemma 2.1, we easily deduce that $S=\langle 7,8,9,10,11,12\rangle$ is a
symmetric numerical semigroup with Frobenius number $13$. Therefore, by
applying Proposition 3.5, we have that $\mathrm{l}(S\setminus\\{10\\})=2$ and
that $\mathrm{h}(S\setminus\\{10\\})=10$. Then, since
$2\mathrm{h}(S\setminus\\{10\\})-\mathrm{F}(S\setminus\\{10\\})=7\in
S\setminus\\{10\\}$, from Proposition 3.7 (or Corollary 3.8) we conclude that
$\mathrm{PF}(S\setminus\\{10\\})=\\{10,13\\}$.

Now our purpose is to study the numerical semigroups $S$ such that
$\mathrm{l}(S)=3$. As a consequence of Lemma 3.3 and Propositions 2.3 and 3.5,
we have that, if $Q$ is a $3$-semigroup, then there exist a pseudo-symmetric
numerical semigroup $P$ and $x\in\mathrm{msg}(P)$ such that
$\mathrm{F}(P)=\mathrm{F}(Q)$, $x<\mathrm{F}(P)$, and $Q=P\setminus\\{x\\}$.

We will use the study made in [9] in order to obtain results about the pseudo-
Frobenius numbers of the $3$-semigroups.

Let us recall that a numerical semigroup $S$ is an URPSY-semigroup if there
exist a pseudo-symmetric numerical semigroup $T$ and $x\in\mathrm{msg}(T)$
such that $S=T\setminus\\{x\\}$.

Let us observe that, if $S$ is a $3$-semigroup, then $S$ is an URPSY-
semigroup. However, $\langle 3,4,5\rangle\setminus\\{4\\}=\langle
3,5,7\rangle$ is an URPSY-semigroup and $\mathrm{l}(\langle 3,5,7\rangle)=1$.
Consequently, there exist URPSY-semigroups that are not $3$-semigroups.

The following result can be deduced from Proposition 23 of [9].

######  Proposition 3.10.

Let $S$ be a numerical semigroup. Then $\mathrm{l}(S)=3$ if and only if $S$ is
an URPSY-semigroup and does not belong to the set

$\displaystyle U=\big{\\{}\langle 3,5,7\rangle,\langle 4,5,6,7\rangle,\langle
4,5,11\rangle\big{\\}}\cup\big{\\{}\langle 3,x+3\rangle\mid
x\in{\mathbb{N}}\setminus\\{0\\},\ 3\\!\not|\,x\big{\\}}\,\cup$
$\displaystyle\big{\\{}\langle m,m+1,\ldots,2m-3\rangle\mid m\in{\mathbb{N}},\
m\geq 5\big{\\}}.$

The next result is deduced form Lemmas 25, 26, and 27 of [9].

######  Proposition 3.11.

If $S$ is a $3$-semigroup, then

  1. 1.

$\left\\{\mathrm{F}(S),\mathrm{h}(S)\right\\}\subseteq\mathrm{PF}(S)\subseteq\left\\{\mathrm{F}(S),\mathrm{h}(S),\frac{\mathrm{F}(S)}{2},\mathrm{F}(S)-\mathrm{h}(S)\right\\};$

  2. 2.

$\frac{\mathrm{F}(S)}{2}\in\mathrm{PF}(S)$ if and only if
$\,\mathrm{h}(S)-\frac{\mathrm{F}(S)}{2}\notin S$;

  3. 3.

$\mathrm{F}(S)-\mathrm{h}(S)\in\mathrm{PF}(S)$ if and only if
$\,2\mathrm{h}(S)-\mathrm{F}(S)\notin S$.

As a direct consequence of the above proposition, we have the following
result.

######  Corollary 3.12.

If $S$ is a $3$-semigroup, then $\mathrm{t}(S)\in\\{2,3,4\\}$. Moreover,

  * a)

the following conditions are equivalents.

    * a.1)

$\mathrm{t}(S)=2$.

    * a.2)

$\mathrm{h}(S)-\frac{\mathrm{F}(S)}{2}\in S$.

    * a.3)

$\mathrm{PF}(S)=\left\\{\mathrm{F}(S),\mathrm{h}(S)\right\\}$.

  * b)

the following conditions are equivalents.

    * b.1)

$\mathrm{t}(S)=3$.

    * b.2)

$\mathrm{h}(S)-\frac{\mathrm{F}(S)}{2}\notin S$ and
$\,2\mathrm{h}(S)-\mathrm{F}(S)\in S$.

    * b.3)

$\mathrm{PF}(S)=\left\\{\mathrm{F}(S),\mathrm{h}(S),\frac{\mathrm{F}(S)}{2}\right\\}$.

  * c)

the following conditions are equivalents.

    * c.1)

$\mathrm{t}(S)=4$.

    * c.2)

$2\mathrm{h}(S)-\mathrm{F}(S)\notin S$.

    * c.3)

$\mathrm{PF}(S)=\left\\{\mathrm{F}(S),\mathrm{h}(S),\frac{\mathrm{F}(S)}{2},\mathrm{F}(S)-\mathrm{h}(S)\right\\}$.

In the next example we illustrate the above results.

######  Example 3.13.

From Lemma 2.1, we have that $S=\langle 8,9,10,11,12,13,15\rangle$ is a
pseudo-symmetric numerical semigroup with Frobenius number $14$. Therefore, by
applying Proposition 3.5, we have that $\mathrm{l}(S\setminus\\{10\\})=3$ and
that $\mathrm{h}(S\setminus\\{10\\})=10$. Since
$2\mathrm{h}(S\setminus\\{10\\})-\mathrm{F}(S\setminus\\{10\\})=6\notin
S\setminus\\{10\\}$, from item c of Corollary 3.12 we conclude that
$\mathrm{PF}(S\setminus\\{10\\})=\\{14,10,7,4\\}$.

##  4 $\boldsymbol{2n}$-semigroups and $\boldsymbol{(2n+1)}$-semigroups

Let $n\in{\mathbb{N}}$. We will begin this section showing how can we obtain
$2n$-semigroups and $(2n+1)$-semigroups from symmetric and pseudo-symmetric
numerical semigroups, respectively. (Let us recall that, if $A$ is a set, then
$\\#(A)$ is the cardinality of $A$.)

######  Proposition 4.1.

Let $S$ be a symmetric numerical semigroup. Let us take a set
$A\subseteq\left\\{x\in
S\,\big{|}\,\frac{\mathrm{F}(S)}{2}<x<\mathrm{F}(S)\right\\}$ such that
$\\#(A)=n$ and $S\setminus A$ is a numerical semigroup. Then
$\mathrm{l}(S\setminus A)=2n$. Moreover, each $2n$-semigroup can be obtain in
this way.

###### Proof.

It is clear that, if $x\in A$, then $x\notin S\setminus A$ and
$\mathrm{F}(S\setminus A)-x\notin S\setminus A$ (note that
$\mathrm{F}(S\setminus A)=\mathrm{F}(S)$). Therefore, $\mathrm{l}(S\setminus
A)\geq 2n$. On the other hand, having in mind that $S$ is symmetric, we deduce
that, if $\left\\{h,\mathrm{F}(S\setminus A)-h\right\\}\cap(S\setminus
A)=\emptyset$, then $\max\left\\{h,\mathrm{F}(S\setminus A)-h\right\\}\in A$.
Therefore, $\mathrm{l}(S\setminus A)\leq 2\\#(A)=2n$. Consequently,
$\mathrm{l}(S\setminus A)=2n$.

Now, let $T$ be a numerical semigroup with $\mathrm{l}(T)=2n$. We define the
following sequence of numerical semigroups (recalling item 2 of Lemma 3.1).

  * •

$T_{0}=T$;

  * •

$T_{k+1}=T_{k}\cup\\{\mathrm{h}(T_{k})\\}$, if $0\leq k\leq n-1$.

Then, by applying Lemma 3.4, we have that $T=T_{0}\subsetneq
T_{1}\subsetneq\cdots\subsetneq T_{n}$ and $\mathrm{l}(T_{n})=0$. Moreover,
from Proposition 2.3, $T_{n}$ is a symmetric numerical semigroup. Finally,
$A=T_{n}\setminus T\subset\left\\{x\in
T_{n}\,\big{|}\,\frac{\mathrm{F}(T_{n})}{2}<x<\mathrm{F}(T_{n})\right\\}$ and
$\\#(A)=n$. ∎

As a consequence of the above proposition, we have the next result.

######  Corollary 4.2.

Let $l$ be an even non-negative integer. If $S$ is an $l$-semigroup, then
$\mathrm{F}(S)$ is odd.

Let us illustrate the previous results with an example.

######  Example 4.3.

Let $S$ be the symmetric numerical semigroup given by

$S=\langle 5,7,9,11\rangle=\\{0,5,7,9,10,11,12,14,\to\\}.$

It is clear that $\mathrm{F}(S)=13$, $\\{7,12\\}\subseteq\left\\{x\in
S\,\big{|}\,\frac{\mathrm{F}(S)}{2}<x<\mathrm{F}(S)\right\\}$, and
$S\setminus\\{7,12\\}$ is a numerical semigroup. Therefore we can apply
Proposition 4.1, getting that $\mathrm{l}(S\setminus\\{7,12\\})=2\times 2=4$.

The proof of the following result is similar to the proof of Proposition 4.1.
So, we omit it.

######  Proposition 4.4.

Let $S$ be a pseudo-symmetric numerical semigroup. Let us take a set
$A\subseteq\left\\{x\in
S\,\big{|}\,\frac{\mathrm{F}(S)}{2}<x<\mathrm{F}(S)\right\\}$ such that
$\\#(A)=n$ and $S\setminus A$ is a numerical semigroup. Then
$\mathrm{l}(S\setminus A)=2n+1$. Moreover, each $(2n+1)$-semigroup can be
obtain in this way.

The next result is consequence of the above proposition.

######  Corollary 4.5.

Let $l$ be an odd non-negative integer. If $S$ is an $l$-semigroup, then
$\mathrm{F}(S)$ is even.

Let us see an illustrative example of two previous results.

######  Example 4.6.

Let $S$ be the pseudo-symmetric numerical semigroup given by

$S=\langle 5,8,11,12\rangle=\\{0,5,8,10,11,12,13,15,\to\\}.$

Clearly $\mathrm{F}(S)=14$, $\\{11,12\\}\subseteq\left\\{x\in
S\,\big{|}\,\frac{\mathrm{F}(S)}{2}<x<\mathrm{F}(S)\right\\}$, and
$S\setminus\\{11,12\\}$ is a numerical semigroup. Therefore, by applying
Proposition 4.4, we have that $\mathrm{l}(S\setminus\\{11,12\\})=2\times
2+1=5$.

Let $I$ be an irreducible numerical semigroup. Now we are interested in
showing an algorithm which allows us to compute all the numerical semigroups
of the form $I\setminus A$ with $A\subseteq\left\\{x\in
I\,\big{|}\,\frac{\mathrm{F}(I)}{2}<x<\mathrm{F}(I)\right\\}$.

If $S$ is a numerical semigroup, then we denote by $\Delta(S)=\left\\{s\in
S\,\big{|}\,s<\frac{\mathrm{F}(S)}{2}\right\\}$. The following result has an
immediate proof.

######  Proposition 4.7.

Let $I,S$ be numerical semigroups such that $I$ is irreducible, $S\subseteq
I$, and $\mathrm{F}(S)=\mathrm{F}(I)$. Then $S=I\setminus A$ for some
$A\subseteq\left\\{\\!x\in
I\,\big{|}\frac{\mathrm{F}(I)}{2}<x<\mathrm{F}(I)\\!\right\\}$ if and only if
$\Delta(S)=\Delta(I)$.

Let $A,B$ be two numerical semigroups such that $A\subseteq B$. We denote by
$[A,B]=\\{X\mid X\mbox{ is a numerical semigroup and }A\subseteq X\subseteq
B\\}$. On the other hand, if $S$ is a numerical semigroup, then we denote by
$\theta(S)$ the numerical semigroup
$\langle\Delta(S)\rangle\cup\\{\mathrm{F}(S)+1,\to\\}$. The next result is an
immediate consequence of Proposition 4.7.

######  Corollary 4.8.

Let $I$ be an irreducible numerical semigroup. Then
$[\theta(I),I]=\left\\{I\setminus A\,\big{|}\,A\subseteq\big{\\{}\\!x\in
I\,\big{|}\,\frac{\mathrm{F}(I)}{2}<x<\mathrm{F}(I)\\!\big{\\}},\ I\setminus
A\mbox{ is a numerical semigroup}\right\\}$.

At this point, our purpose is to show an algorithm to compute $[\theta(I),I]$.
For that we need the concept of (rooted) tree.

A _graph_ $G$ is a pair $(V,E)$ where $V$ is a non-empty set (which elements
are called _vertices_ of $G$) and $E$ is a subset of $\\{(v,w)\in V\times
V\mid v\neq w\\}$ (which elements are called _edges_ of $G$).

A _path (of length $n$) connecting the vertices $x$ and $y$ of $G$_ is a
sequence of different edges
$(v_{0},v_{1}),(v_{1},v_{2}),\ldots,(v_{n-1},v_{n})$ such that $v_{0}=x$ and
$v_{n}=y$.

We say that a graph $G$ is a _(rooted) tree_ if there exists a vertex $r$
(known as the _root_ of $G$) such that, for any other vertex $x$ of $G$, there
exists a unique path connecting $x$ and $r$. If $(x,y)$ is an edge of the
tree, then we say that $x$ is a _child_ of $y$. (See [14].)

If $A,B$ are numerical semigroups such that $A\subsetneq B$, then we denote by
$\mathrm{F}_{B}(A)=\max(B\setminus A)$. Moreover, according to the Frobenius
number $\mathrm{F}({\mathbb{N}})=-1$, we define $\mathrm{F}_{B}(B)=-1$. The
following result is Lemma 4.35 of [13].

######  Lemma 4.9.

Let $A,B$ be two numerical semigroups such that $A\subsetneq B$. Then
$A\cup\\{\mathrm{F}_{B}(A)\\}$ is another numerical semigroup.

We define the graph $\mathrm{G}\big{(}[A,B]\big{)}$ in the following way:
$[A,B]$ is the set of vertices and $(X,Y)\in[A,B]\times[A,B]$ is an edge if
$X\cup\\{\mathrm{F}_{B}(X)\\}=Y$. The next result is easy to prove (see
Corollary 4.5 of [8]).

######  Proposition 4.10.

$\mathrm{G}\big{(}[A,B]\big{)}$ is a tree with root $B$. Moreover, the
children set of a vertex $P$ is $\big{\\{}P\setminus\\{x\\}\mid
x\in\mathrm{msg}(P),\ x>\mathrm{F}_{B}(P),\
P\setminus\\{x\\}\in[A,B]\big{\\}}.$

Let us note that, if $I$ is an irreducible numerical semigroup and
$P\in[\theta(I),I]$ with $P\not=I$, then $\mathrm{F}_{I}(P)=\mathrm{h}(P)$.
Moreover, in order to keep the equality true and according to the value
$\mathrm{F}_{I}(I)=-1$, we define $\mathrm{h}(I)=-1$ for any irreducible
numerical semigroup $I$. Thereby, we can enunciate Proposition 4.10 as
follows.

######  Corollary 4.11.

Let $I$ be an irreducible numerical semigroup. Then
$\mathrm{G}\big{(}[\theta(I),I]\big{)}$ is a tree with root $I$. Moreover, if
$P$ is a vertex of such a tree, then its children set is
$\left\\{P\setminus\\{x\\}\,\big{|}\,x\in\mathrm{msg}(P),\
\frac{\mathrm{F}(I)}{2}<x<\mathrm{F}(I),\ \mathrm{h}(P)<x\right\\}.$

We are now ready to five an algorithm which allows us to compute
$[\theta(I),I]$. If $(x,y)$ is an ordered pair, then we denote by
$\pi_{1}(x,y)=x$.

######  Algorithm 4.12.

  * INPUT: An irreducible numerical semigroup $I$.

  * OUTPUT: $[\theta(I),I]$.

  * (1)

$n=0$, $A_{0}=\left\\{(I,-1)\right\\}$, $B_{0}=\left\\{I\right\\}$.

  * (2)

$n:=n+1$.

  * (3)

$A_{n}=\left\\{(P\setminus\\{x\\},x)\,\big{|}\,(P,y)\in
A_{n-1},\,\\!x\in\mathrm{msg}(P),\,\\!\frac{\mathrm{F}(I)}{2}<x<\mathrm{F}(I),\,\\!y<x\right\\}$.

  * (4)

If $A_{n}=\emptyset$, then return $B_{0}\cup B_{1}\cup\cdots\cup B_{n-1}$.

  * (5)

$B_{n}=\pi_{1}(A_{n})$ and goto (2).

Let us illustrate the performance of this algorithm with an example.

######  Example 4.13.

It is clear that $I=\langle 5,7,9,11\rangle$ is a symmetric numerical
semigroup with $\mathrm{F}(I)=13$. Therefore, $\theta(I)=\langle
5\rangle\cup\\{14,\to\\}=\langle 5,14,16,17,18\rangle$. Let us compute
$[\theta(I),I]$ with the help of Algorithm 4.12.

  * •

$n=0$, $A_{0}=\big{\\{}(\langle 5,7,9,11\rangle,-1)\big{\\}}$,
$B_{0}=\big{\\{}\langle 5,7,9,11\rangle\big{\\}}$.

  * •

$n=1$.

  * •

$A_{1}=\big{\\{}(\langle 5,9,11,12\rangle,7),(\langle
5,7,11\rangle,9),(\langle 5,7,9\rangle,11)\big{\\}}$.

  * •

$B_{1}=\big{\\{}\langle 5,9,11,12\rangle,\langle 5,7,11\rangle,\langle
5,7,9\rangle\big{\\}}$.

  * •

$n=2$.

  * •

$A_{2}=\big{\\{}(\langle 5,11,12,14,18\rangle,9),(\langle
5,9,12,16\rangle,11),(\langle 5,9,11,17\rangle,12),\\\ \mbox{ }\hskip
28.45274pt(\langle 5,7,16,18\rangle,11)\big{\\}}$.

  * •

$B_{2}=\big{\\{}\langle 5,11,12,14,18\rangle,\langle 5,9,12,16\rangle,\langle
5,9,11,17\rangle,\langle 5,7,16,18\rangle\big{\\}}$.

  * •

$n=3$.

  * •

$A_{3}=\big{\\{}(\langle 5,12,14,16,18\rangle,11),(\langle
5,11,14,17,18\rangle,12),(\langle 5,9,16,17\rangle,12)\big{\\}}$.

  * •

$B_{3}=\big{\\{}\langle 5,12,14,16,18\rangle,\langle
5,11,14,17,18\rangle,\langle 5,9,16,17\rangle\big{\\}}$.

  * •

$n=4$.

  * •

$A_{4}=\big{\\{}(\langle 5,14,16,17,18\rangle,12)\big{\\}}$.

  * •

$B_{4}=\big{\\{}\langle 5,14,16,17,18\rangle\big{\\}}$.

  * •

$n=5$.

  * •

$A_{5}=\emptyset$.

Therefore, in this example, $[\theta(I),I]=B_{0}\cup B_{1}\cup B_{2}\cup
B_{3}\cup B_{4}$. Now, let us depict the tree
$\mathrm{G}\big{(}[\theta(I),I]\big{)}$ corresponding to this example.

$\langle 5,7,9,11\rangle$7911$\langle 5,9,11,12\rangle$$\langle
5,7,11\rangle$$\langle 5,7,9\rangle$9111211$\langle
5,11,12,14,18\rangle$$\langle 5,9,12,16\rangle$$\langle
5,9,11,17\rangle$$\langle 5,7,16,18\rangle$111212$\langle
5,12,14,16,18\rangle$$\langle 5,11,14,17,18\rangle$$\langle
5,9,16,17\rangle$12$\langle 5,14,16,17,18\rangle$

The number which appear over each edge $(Q,P)$ is the minimal generator $x$ of
$P$ such that $Q=P\setminus\\{x\\}$. Note that $x=\mathrm{h}(Q)$.

Let $G$ be a tree with root $r$. The _depth_ of a vertex $x$ of $G$ is the
number of edges in the unique path connecting $x$ and $r$. The _$n$ -level_ of
$G$ is the set of all the vertices with depth equal to $n$. Lastly, the
_height_ of $G$ is the maximum depth of any vertex of $G$. (See [14].)

Let us observe that, in Example 4.13, we have a tree of height $4$. Moreover,
the $n$-level of such a tree is $B_{n}$ (for $n=0,1,2,3,4$).

The following result is easy to prove.

######  Proposition 4.14.

Let $I$ be an irreducible numerical semigroup.

  1. 1.

The height of the tree $\mathrm{G}\big{(}[\theta(I),I]\big{)}$ is equal to
$\\#(I\setminus\theta(I))$.

  2. 2.

If $S$ belongs to the $n$-level of $\mathrm{G}\big{(}[\theta(I),I]\big{)}$,
then $\mathrm{l}(S)=2n+\mathrm{l}(I)$.

  3. 3.

$\left\\{\mathrm{l}(S)\mid
S\in[\theta(I),I]\right\\}=\left\\{2n+\mathrm{l}(I)\mid
n\in\\{0,1,\ldots,\\#(I\setminus\theta(I)\\}\right\\}$.

Let us illustrate the content of this proposition with an example.

######  Example 4.15.

Following Example 4.13, we know that $I=\langle 5,7,9,11\rangle$ is a
symmetric numerical semigroup. Therefore, $I$ is an irreducible numerical
semigroup with $\mathrm{l}(I)=0$ (see Proposition 2.3).

It is clear that $\theta(I)=\langle 5\rangle\cup\\{14,\to\\}=\langle
5,14,16,17,18\rangle$ and that $I\setminus\theta(I)=\\{7,9,11,12\\}$. Thus,
$\mathrm{G}\big{(}[\theta(I),I]\big{)}$ is a tree with height equal to $4$.
Consequently, $\left\\{\mathrm{l}(S)\mid
S\in[\theta(I),I]\right\\}=\\{0,2,4,6,8\\}$. Moreover,
$\big{\\{}S\in[\theta(I),I]\mid\mathrm{l}(S)=6\big{\\}}=\big{\\{}S\in\mathrm{G}\big{(}[\theta(I),I]\big{)}\mid
S\mbox{ has depth equal to }3\big{\\}}=B_{3}$.

Let us observe that, if $n\in{\mathbb{N}}$, we can compute all the
$2n$-semigroups ($(2n+1)$-semigroups, respectively) in two steps.

  1. 1.

Compute the set $\mathcal{F}(n)$ ($\mathcal{G}(n)$, respectively) formed by
all the symmetric numerical semigroups (pseudo-symmetric numerical semigroups,
respectively) $I$ such that $\\#(I\setminus\theta(I))\geq n$.

  2. 2.

For each $I\in\mathcal{F}(n)$ ($\mathcal{G}(n)$, respectively) compute the
$n$-level of $\mathrm{G}\big{(}[\theta(I),I]\big{)}$.

Note that there exist infinitely many irreducible numerical semigroups $I$
such that $\\#(I\setminus\theta(I))=n$. Therefore, there exist infinitely many
$2n$-semigroups and infinitely many $(2n+1)$-semigroups. Our next purpose is
to find an algorithm which allows us to build the finite set formed by all the
$K$-semigroups with a prefixed Frobenius number.

##  5 ${\boldsymbol{K}}$-semigroups with a fixed Frobenius number

In [4] it is shown a rather efficient algorithmic process to compute all the
irreducible numerical semigroups with a prefixed Frobenius number. The idea of
such an algorithm is the following one.

Let $\mathcal{I}(F)=\left\\{S\mid S\mbox{ is an irreducible numerical
semigroup with }\mathrm{F}(S)=F\right\\}$. We define the graph
$\mathrm{G}(\mathcal{I}(F))$ as follows: $\mathcal{I}(F)$ is the set of
vertices and $(T,S)\in\mathcal{I}(F)\times\mathcal{I}(F)$ is an edge if
$\mathrm{m}(T)<\frac{F}{2}$ and
$S=(T\setminus\\{\mathrm{m}(T)\\})\cup\left\\{F-\mathrm{m}(T)\right\\}$.

The next results are Proposition 2.7 and Theorem 2.9 of [4], respectively.

######  Proposition 5.1.

Let $F$ be a positive integer. Then there exists an unique irreducible
numerical semigroup $\mathrm{C}(F)$ with Frobenius number $F$ and multiplicity
greater than $\frac{F}{2}$. Moreover,

$\mathrm{C}(F)=\left\\{\begin{array}[]{ll}\vspace{1pt}\left\\{0,\frac{F+1}{2},\to\right\\}\setminus\\{F\\},&\mbox{if
$F$ is odd,}\\\\[2.0pt]
\left\\{0,\frac{F}{2}+1,\to\right\\}\setminus\\{F\\},&\mbox{if $F$ is
even.}\end{array}\right.$

######  Proposition 5.2.

Let $F$ be a positive integer. Then $\mathrm{G}(\mathcal{I}(F))$ is a tree
with root $\mathrm{C}(F)$. Moreover, if $S\in\mathcal{I}(F)$, then the
children set of $S$ is $\Big{\\{}(S\setminus\\{x\\})\cup\\{F-x\\}\,\big{|}$
$x\in\mathrm{msg}(S),\ \frac{F}{2}<x<F,\ 2x-F\notin S,\ 3x\not=2F,\
4x\not=3F,\ F-x<\mathrm{m}(S)\Big{\\}}.$

Let us illustrate both of the above results with an example.

######  Example 5.3.

We want to compute all the irreducible numerical semigroups with Frobenius
number $11$. For that, we build the tree $\mathrm{G}(\mathcal{I}(11))$
starting at its root $\mathrm{C}(11)=\langle 6,7,8,9,10\rangle$ and adding to
the known vertices their children (that are given by Proposition 5.2). Thus we
have the following tree (for more details see Example 2.10 of [4]).

$\langle 6,7,8,9,10\rangle$$\langle 3,7\rangle$$\langle 4,6,9\rangle$$\langle
5,7,8,9\rangle$$\langle 2,13\rangle$$\langle 4,5\rangle$

The next result gives to us the conditions that must satisfied by two non-
negative integers $K$ and $F$ in order to have at least one $K$-semigroup with
Frobenius number $F$. As it is usual, if $q$ is a rational number, then we
denote by $\lfloor q\rfloor=\max\\{z\in{\mathbb{Z}}\mid z\leq q\\}$.

######  Proposition 5.4.

Let $K,F$ be non-negative integers. Then there exists at least one
$K$-semigroup with Frobenius number $F$ if and only if $K+F$ is odd and $F\geq
K+1$.

###### Proof.

(Necessity.) By Corollaries 4.2 and 4.5, we know that $K+F$ is odd. In
addition, by Propositions 4.1 and 4.4, we easily deduce that $F\geq K+1$.

(Sufficiency.) It is enough to take $S=\mathrm{C}(F)\setminus A$ where $A$ is
a $\left\lfloor\frac{K}{2}\right\rfloor$-cardinality subset of
$\\{x\in\mathrm{C}(F)\mid 0\not=x<F\\}$ and applied Propositions 4.1 and 4.4.
∎

Let us see an example about the previous proposition.

######  Example 5.5.

Let us build an $8$-semigroup with Frobenius number $17$. Since $8+17$ is odd
and $17\geq 8+1$, by applying Proposition 5.4, we know that there exists at
least one. Moreover, from the proof of such a proposition, we have that
$S=\mathrm{C}(17)\setminus\\{9,11,13,16\\}=\\{0,10,12,14,15,18,\to\\}$ is an
$8$-semigroup with Frobenius number $17$.

We are now interested in determining all irreducible numerical semigroups $I$
such that the set $[\theta(I),I]$ contains at least one $K$-semigroup. The
following result can be easily deduced from Proposition 4.14.

######  Proposition 5.6.

Let $I$ be an irreducible numerical semigroup and $K\in{\mathbb{N}}$ such that
$\mathrm{F}(I)+K$ is odd and $\mathrm{F}(I)\geq K+1$. Then $[\theta(I),I]$
contains at least one $K$-semigroup if and only if
$\\#(I\setminus\theta(I))\geq\left\lfloor\frac{K}{2}\right\rfloor$.

We are ready to show an algorithm which allows us to compute all the
$K$-semigroups with a fixed Frobenius number.

######  Algorithm 5.7.

  * INPUT: Two non-negative integers $K$ and $F$.

  * OUTPUT: The set of all $K$-semigroups with Frobenius number $F$.

  * (1)

If $F+K$ is even, then return $\emptyset$.

  * (2)

If $F<K+1$, then return $\emptyset$.

  * (3)

Compute the set
$\mathcal{F}=\left\\{I\in\mathcal{I}(F)\,\big{|}\,\\#(I\setminus\theta(I))\geq\left\lfloor\frac{K}{2}\right\rfloor\right\\}$.

  * (4)

For each $I\in\mathcal{F}$, compute the set

$\mathrm{D}(I)=\left\\{S\in\mathrm{G}\big{(}[\theta(I),I]\big{)}\,\big{|}\,S\mbox{
belongs to the $\left\lfloor\frac{K}{2}\right\rfloor$-level}\right\\}.$

  * (5)

Return $\bigcup_{I\in\mathcal{F}}\mathrm{D}(I)$.

######  Remark 5.8.

It is clear that, if $I_{1},I_{2}$ are irreducible numerical semigroups (with
the same Frobenius number), then $\Delta(I_{1})=\Delta(I_{2})$ if and only if
$I_{1}=I_{2}$. Consequently,
$[\theta(I_{1}),I_{1}]\cap[\theta(I_{2}),I_{2}]\not=\emptyset$ if and only if
$I_{1}=I_{2}$. Therefore, $\bigcup_{I\in\mathcal{F}}\mathrm{D}(I)$ is a
partition of the set of all $K$-semigroups with Frobenius number $F$ (see
[3]).

The next result is useful to carry out the step (3) in the previous algorithm.

######  Proposition 5.9.

Let $F$ be a positive integer.

  1. 1.

$\\#\big{(}\mathrm{C}(F)\setminus\theta(\mathrm{C}(F))\big{)}=\left\lfloor\frac{F-1}{2}\right\rfloor$.

  2. 2.

If $Q$ is a child of $P$ in the tree $\mathrm{G}(\mathcal{I}(F))$, then
$\\#(Q\setminus\theta(Q))<\\#(P\setminus\theta(P))$.

###### Proof.

The first statement is trivial. For the second one, having in mind that
$Q=(P\setminus\\{x\\})\cup\\{F-x\\}$ for some $x\in\mathrm{msg}(P)$ such that
$\frac{F}{2}<x<F$, then we easily deduce that $Q\setminus\theta(Q)\subsetneq
P\setminus\theta(P)$ and, therefore,
$\\#(Q\setminus\theta(Q))<\\#(P\setminus\theta(P))$. ∎

We finish this section with an example.

######  Example 5.10.

Let us suppose that we want to build all the $6$-semigroups with Frobenius
number $11$. For that we use Algorithm 5.7.

  * (1)

$11+6$ is odd.

  * (2)

$11\geq 6+1$.

  * (3)

By applying the algorithm of [4] which we commented at the beginning of this
section and having in mind Proposition 5.9, we have that

$\mathcal{F}=\big{\\{}I\in\mathcal{I}(11)\mid\\#(I\setminus\theta(I))\geq
3\big{\\}}=\big{\\{}\langle 6,7,8,9,10\rangle,\langle 4,6,9\rangle,\langle
5,7,8,9\rangle\big{\\}}.$

Let us observe that we do not need to compute al the numerical semigroups of
$\mathcal{I}(11)$ (like in Example 5.3). In fact, from Proposition 5.9, we
only need to compute $\mathrm{C}(11)=\langle 6,7,8,9,10\rangle$,
$I_{1}=\langle 3,7\rangle$, $I_{2}=\langle 4,6,9\rangle$, and $I_{3}=\langle
5,7,8,9\rangle$ because
$\\#\big{(}\mathrm{C}(11)\setminus\theta(\mathrm{C}(11))\big{)}=5$,
$\\#(I_{1}\setminus\theta(I_{1}))=1$, and
$\\#(I_{1}\setminus\theta(I_{2}))=\\#(I_{1}\setminus\theta(I_{3}))=3$.

  * (4)

$\mathrm{D}(\mathrm{C}(11))=\mathrm{D}(\langle
6,7,8,9,10\rangle)=\big{\\{}\langle 6,7,15,16,17\rangle,\langle
6,8,13,15,17\rangle,$
$\langle 6,9,13,14,16,17\rangle,\langle 6,10,13,14,15,17\rangle,\langle
7,8,12,13,17,18\rangle,$
$\langle 7,9,12,13,15,17\rangle,\langle 7,10,12,13,15,16,18\rangle,\langle
8,9,12,13,14,15,19\rangle,$
$\langle 8,10,12,13,14,15,17,19\rangle,\langle
9,10,12,13,14,15,16,17\rangle\big{\\}}$.
$\mathrm{D}(I_{2})=\mathrm{D}(\langle 4,6,9\rangle)=\big{\\{}\langle
4,13,14,15\rangle\big{\\}}$.
$\mathrm{D}(I_{3})=\mathrm{D}(\langle 5,7,8,9\rangle)=\big{\\{}\langle
5,12,13,14,16\rangle\big{\\}}$.

  * (5)

$\mathrm{D}(\mathrm{C}(11))\cup\mathrm{D}(I_{2})\cup\mathrm{D}(I_{3})$ is the
set of all $6$-semigroups with Frobenius number $11$.

## References

  * [1] V. Barucci, D. E. Dobbs, and M. Fontana, _Maximality Properties in Numerical Semigroups and Applications to One-Dimensional Analytically Irreducible Local Domains_ , Mem. Amer. Math. Soc. 598 (1997).
  * [2] V. Barucci, R. Fröberg, One-dimensional almost Gorenstein rings, _J. Algebra_ 188 (1997), 418-442.
  * [3] V. Blanco, J. C. Rosales, On the enumeration of the set of numerical semigroups with fixed Frobenius number, _Comput. Math. Appl._ 63 (2012), 1204–1211.
  * [4] V. Blanco, J. C. Rosales, The tree of irreducible numerical semigroups with fixed Frobenius number, _Forum Math._ 25 (2013), 1249–1261.
  * [5] R. Fröberg, G. Gottlieb, and R. Häggkvist, On numerical semigroups, _Semigroup Forum_ 35 (1987), 63–83.
  * [6] J. Jäger, Längenberechnung und kanonische Ideale in eindimensionalen Ringen, _Arch. Math. (Basel)_ 29 (1977), 504–512.
  * [7] E. Kunz, The value-semigroup of a one-dimensional Gorenstein ring, _Proc. Amer. Math. Soc._ 25 (1970), 748–751.
  * [8] A. M. Robles-Pérez, J. C. Rosales, Frobenius restricted varieties in numerical semigroups. Preprint (arXiv:1605.03778 [math.GR]).
  * [9] J. C. Rosales, Adding or removing an element from a pseudo-symmetric numerical semigroup, _Boll. Unione Mat. Ital. Sez. B Artic. Ric. Mat. (8)_ 9 (2006), 681–696.
  * [10] J. C. Rosales, Numerical semigroups that differ from a symmetric numerical semigroup in one element, _Algebra Colloq._ 15 (2008), 23–32.
  * [11] J. C. Rosales and M. B. Branco, Numerical semigroups that can be expressed as an intersection of symmetric numerical semigroups, J. Pure Appl Algebra 171 (2002), 303–314.
  * [12] J. C. Rosales, M. B. Branco, Irreducible numerical semigroups, _Pacific J. Math._ 209(1) (2003), 131–143.
  * [13] J. C. Rosales and P. A. García-Sánchez, _Numerical semigroups_ , Developments in Mathematics, Vol. 20 (Springer, New York, 2009).
  * [14] K. H. Rosen, _Handbook of Discrete and Combinatorial Mathematics_ (CRC Press, Boca Raton, 2000).
  * [15] H. S. Wilf, A circle-of-lights algorithm for the “money-changing problem”, _Amer. Math. Monthly_ 85 (1978), 562–565.