OFFSET
1,1
COMMENTS
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.
EXAMPLE
a(n) modulo 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, ...
===== ==================================================
3 1, 0, 2, 4, 8, 10, 14, 16, 20, 26, 28, ...
4 0, 2, 1, 3, 7, 9, 13, 15, 19, 25, 27, ...
7 1, 2, 3, 0, 4, 6, 10, 12, 16, 22, 24, ...
8 0, 1, 2, 6, 3, 5, 9, 11, 15, 21, 23, ...
16 0, 2, 4, 5, 6, 10, 1, 3, 7, 13, 15, ...
157 1, 2, 3, 4, 8, 12, 13, 14, 4, 17, 29, ...
16957 1, 2, 3, 4, 5, 8, 9, 10, 17, 8, 0, ...
19231 1, 2, 4, 5, 8, 9, 13, 16, 20, 25, 20, ...
80942 0, 1, 3, 6, 7, 9, 12, 17, 18, 26, 30, ...
PROG
(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); }
a(n) = {my(k=3); while(!isok(k, n), k++); k; } \\ Michel Marcus, Jun 04 2019
(Python)
from sympy import prime
def A306612(n):
plist, x = [prime(i) for i in range(1, n+1)], 3
rlist = [-x % p for p in plist]
while True:
for i in range(n-1):
if rlist[i] >= rlist[i+1]:
break
else:
return x
for i in range(n):
rlist[i] = (rlist[i] - 1) % plist[i]
x += 1 # Chai Wah Wu, Jun 15 2019
CROSSREFS
KEYWORD
nonn,hard
AUTHOR
Charlie Neder, Jun 03 2019
EXTENSIONS
a(16)-a(19) from Daniel Suteu, Jun 04 2019
a(20)-a(25) from Giovanni Resta, Jun 16 2019
a(26)-a(27) from Bert Dobbelaere, Jun 22 2019
a(28)-a(30) from Bert Dobbelaere, Sep 04 2019
STATUS
approved