cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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

This page as a plain text file.
%I A325057 #24 Dec 22 2024 09:08:00
%S A325057 1,2,3,7,19,94,381,2217,10248,64082,572741,3590815,33731134,291308123,
%T A325057 1896596488,14675287694,147847569839,1642854121867,12717640104203,
%U A325057 134707566446733,1285768348848054,9334472487460317,97284913917125312,922382339920122509,10370484766702974615
%N A325057 Number of positive integers k <= prime(n)# so that (k mod p_1) < (k mod p_2) < ... < (k mod p_n).
%C A325057 This sequence emerges during computation of A306582 and A306612.
%H A325057 Alois P. Heinz, <a href="/A325057/b325057.txt">Table of n, a(n) for n = 0..500</a>
%e A325057 a(3) = 7:
%e A325057   Solutions for k that have increasing remainders modulo the first 3 primes:
%e A325057   k   modulo  2   3   5
%e A325057   =====================
%e A325057   22          0 < 1 < 2
%e A325057   28          0 < 1 < 3
%e A325057    4          0 < 1 < 4
%e A325057    8          0 < 2 < 3
%e A325057   14          0 < 2 < 4
%e A325057   23          1 < 2 < 3
%e A325057   29          1 < 2 < 4
%p A325057 b:= proc(n, i) option remember; `if`(n=0, 1,
%p A325057       add(b(n-1, j-1), j=1..min(i, ithprime(n))))
%p A325057     end:
%p A325057 a:= n-> b(n, infinity):
%p A325057 seq(a(n), n=0..24);  # _Alois P. Heinz_, Jan 04 2023
%o A325057 (Python)
%o A325057 from sympy import prime
%o A325057 def f(k, r, n):
%o A325057     if k==n: return prime(k)-r
%o A325057     global cache ; args = (k, r)
%o A325057     if args in cache: return cache[args]
%o A325057     rv = f(k+1, r+1, n)
%o A325057     if r < (prime(k)-1): rv += f(k, r+1, n)
%o A325057     cache[args]=rv ; return rv
%o A325057 def A325057(n):
%o A325057     global cache ; cache = {}
%o A325057     return f(1, 0, n)
%Y A325057 Cf. A002110, A306582, A306612.
%K A325057 nonn
%O A325057 0,2
%A A325057 _Bert Dobbelaere_, Sep 04 2019
%E A325057 Name edited and a(0)=1 prepended by _Alois P. Heinz_, Jan 04 2023