I didn’t realize your relevant tasks required 64 bit integers. With multinomial data that Stan can actually ingest, the phenomenon you are referring to manifests itself in the leapfrogger taking more and smaller steps and yields imprecise estimates of the irrelevant vector `gamma`

, but MCMC sampling for the simplex `pi`

is fine when you do

```
post <- stan("simplexes.stan", data = list(K = 4, x = 2 *
rmultinom(1, size = .Machine$integer.max, prob = 1:4 / 10)[,1]),
control = list(max_treedepth = 17L))
```

to get

```
> print(post, digits = 4)
Inference for Stan model: simplexes.
4 chains, each with iter=2000; warmup=1000; thin=1;
post-warmup draws per chain=1000, total post-warmup draws=4000.
mean se_mean sd 2.5% 25% 50% 75% 97.5% n_eff Rhat
gamma[1] 0.4009 0.0183 0.2186 0.0888 0.2469 0.3643 0.5115 1.0050 143 1.0113
gamma[2] 0.8018 0.0366 0.4373 0.1776 0.4938 0.7287 1.0232 2.0101 143 1.0113
gamma[3] 1.2027 0.0549 0.6560 0.2664 0.7407 1.0931 1.5347 3.0151 143 1.0113
gamma[4] 1.6036 0.0732 0.8746 0.3552 0.9877 1.4574 2.0462 4.0202 143 1.0113
pi[1] 0.1000 0.0000 0.0000 0.1000 0.1000 0.1000 0.1000 0.1000 2658 0.9998
pi[2] 0.2000 0.0000 0.0000 0.2000 0.2000 0.2000 0.2000 0.2000 4000 0.9994
pi[3] 0.3000 0.0000 0.0000 0.3000 0.3000 0.3000 0.3000 0.3000 4000 1.0005
pi[4] 0.4000 0.0000 0.0000 0.4000 0.4000 0.4000 0.4000 0.4000 4000 0.9994
lp__ -39.5860 0.0715 1.4965 -43.3719 -40.3148 -39.2481 -38.4819 -37.7376 438 1.0062
```

for simplexes.stan defined as

```
data {
int<lower=2> K;
int<lower=0,upper=2147483647> x[K];
}
parameters {
vector<lower=0>[K] gamma;
}
transformed parameters {
vector[K] pi = gamma / sum(gamma);
}
model {
target += exponential_lpdf(gamma | 1);
target += multinomial_lpmf(x | pi);
}
```