Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Nonnegative integers k such that k! mod nextprime(k) is larger than k.
2

%I #41 Mar 10 2023 10:36:18

%S 0,31,120,283,293,712,2872,3287,5028,5129,7088,9553,13229,14232,14799,

%T 15113,20153,20830,23239,30233,31430,31667,34443,40654,44298,50184,

%U 78877,105834,115281,125120,164253,192103,201590,227747,239910,241910,282230,322550,374370

%N Nonnegative integers k such that k! mod nextprime(k) is larger than k.

%H Chai Wah Wu, <a href="/A360805/b360805.txt">Table of n, a(n) for n = 1..213</a>

%F { k >= 0 : k! mod nextprime(k) > k }.

%F A360825(a(n)) > a(n).

%p q:= n-> is(n! mod nextprime(n)>n):

%p select(q, [$0..20000])[];

%o (Python)

%o from itertools import count, islice

%o from functools import reduce

%o from sympy import nextprime

%o def A360805_gen(startvalue=0): # generator of terms >= startvalue

%o n = max(startvalue,0)

%o m = nextprime(n)

%o while True:

%o a = m-1

%o klist = []

%o for i in range(m-1,n,-1):

%o a = a*pow(i,-1,m)%m

%o if a>i-1:

%o klist.append(i-1)

%o yield from sorted(klist)

%o n, m = m, nextprime(m)

%o A360805_list = list(islice(A360805_gen(),30)) # _Chai Wah Wu_, Feb 24 2023

%Y Cf. A000142, A007978, A151800, A360825.

%K nonn

%O 1,2

%A _Alois P. Heinz_, Feb 22 2023