login
Number of positive integers k <= prime(n)# so that (k mod p_1) < (k mod p_2) < ... < (k mod p_n).
3

%I #20 Jan 04 2023 18:15:37

%S 1,2,3,7,19,94,381,2217,10248,64082,572741,3590815,33731134,291308123,

%T 1896596488,14675287694,147847569839,1642854121867,12717640104203,

%U 134707566446733,1285768348848054,9334472487460317,97284913917125312,922382339920122509,10370484766702974615

%N Number of positive integers k <= prime(n)# so that (k mod p_1) < (k mod p_2) < ... < (k mod p_n).

%C This sequence emerges during computation of A306582 and A306612.

%H Alois P. Heinz, <a href="/A325057/b325057.txt">Table of n, a(n) for n = 0..500</a>

%e a(3) = 7:

%e Solutions for k that have increasing remainders modulo the first 3 primes:

%e k modulo 2 3 5

%e =====================

%e 22 0 < 1 < 2

%e 28 0 < 1 < 3

%e 4 0 < 1 < 4

%e 8 0 < 2 < 3

%e 14 0 < 2 < 4

%e 23 1 < 2 < 3

%e 29 1 < 2 < 4

%p b:= proc(n, i) option remember; `if`(n=0, 1,

%p add(b(n-1, j-1), j=1..min(i, ithprime(n))))

%p end:

%p a:= n-> b(n, infinity):

%p seq(a(n), n=0..24); # _Alois P. Heinz_, Jan 04 2023

%o (Python)

%o from sympy import prime

%o def f(k, r, n):

%o ....if k==n: return prime(k)-r

%o ....global cache ; args = (k, r)

%o ....if args in cache: return cache[args]

%o ....rv = f(k+1, r+1, n)

%o ....if r < (prime(k)-1): rv += f(k, r+1, n)

%o ....cache[args]=rv ; return rv

%o def A325057(n):

%o ....global cache ; cache = {}

%o ....return f(1, 0, n)

%Y Cf. A002110, A306582, A306612.

%K nonn

%O 0,2

%A _Bert Dobbelaere_, Sep 04 2019

%E Name edited and a(0)=1 prepended by _Alois P. Heinz_, Jan 04 2023