%I #46 Sep 04 2019 12:11:43
%S 3,4,7,8,16,16,157,157,16957,19231,80942,82372,82372,9624266,19607227,
%T 118867612,4968215191,31090893772,118903377091,187341482252,
%U 1784664085208,12330789708022,68016245854132,68016245854132,10065964847743822,74887595879692807,1825207861455319267,98403562254816509476,283462437415903129597,2126598918934702375802
%N a(n) is the least integer k > 2 such that the remainder of -k modulo p is strictly increasing over the first n primes.
%C 0, 1, and 2 satisfy this condition for all p, so this sequence starts at 3. The growth of this sequence is much more irregular than that of the companion sequence A306582.
%e a(n) modulo 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, ...
%e ===== ==================================================
%e 3 1, 0, 2, 4, 8, 10, 14, 16, 20, 26, 28, ...
%e 4 0, 2, 1, 3, 7, 9, 13, 15, 19, 25, 27, ...
%e 7 1, 2, 3, 0, 4, 6, 10, 12, 16, 22, 24, ...
%e 8 0, 1, 2, 6, 3, 5, 9, 11, 15, 21, 23, ...
%e 16 0, 2, 4, 5, 6, 10, 1, 3, 7, 13, 15, ...
%e 157 1, 2, 3, 4, 8, 12, 13, 14, 4, 17, 29, ...
%e 16957 1, 2, 3, 4, 5, 8, 9, 10, 17, 8, 0, ...
%e 19231 1, 2, 4, 5, 8, 9, 13, 16, 20, 25, 20, ...
%e 80942 0, 1, 3, 6, 7, 9, 12, 17, 18, 26, 30, ...
%o (PARI) isok(k, n) = {my(last = -1, cur); for (i=1, n, cur = -k % prime(i); if (cur <= last, return (0)); last = cur;); return (1);}
%o a(n) = {my(k=3); while(!isok(k, n), k++); k;} \\ _Michel Marcus_, Jun 04 2019
%o (Python)
%o from sympy import prime
%o def A306612(n):
%o plist, x = [prime(i) for i in range(1,n+1)], 3
%o rlist = [-x % p for p in plist]
%o while True:
%o for i in range(n-1):
%o if rlist[i] >= rlist[i+1]:
%o break
%o else:
%o return x
%o for i in range(n):
%o rlist[i] = (rlist[i] - 1) % plist[i]
%o x += 1 # _Chai Wah Wu_, Jun 15 2019
%Y Cf. A306582.
%K nonn,hard
%O 1,1
%A _Charlie Neder_, Jun 03 2019
%E a(16)-a(19) from _Daniel Suteu_, Jun 04 2019
%E a(20)-a(25) from _Giovanni Resta_, Jun 16 2019
%E a(26)-a(27) from _Bert Dobbelaere_, Jun 22 2019
%E a(28)-a(30) from _Bert Dobbelaere_, Sep 04 2019