OFFSET
0,3
COMMENTS
Let i be some positive integer. Let r(n) = i mod prime(n+1). Let m be defined such that s(m-1) <= i < s(m). Then the first m values in the sequence {r(n)} uniquely define the integer (it is the least positive integer requiring those m remainders modulo those primes). If i is a term of {s(n)}, then a(n) = r(n) for n = 0..m-1.
LINKS
Christopher A. Curry, Table of n, a(n) for n = 0..9999
MATHEMATICA
q[n_] := Insert[Table[Mod[Total[Table[Product[Prime[i], {i, 1, r}], {r, m}]] + 1, Prime[m + 1]], {m, n}], 1, 1]; q[65] (* Samuel Harkness, Sep 22 2022 *)
PROG
(PARI) a(n) = if(n==0, return(1)); my(P=1, s=1); forprime(p=2, prime(n), s+=P*=p); s % prime(n+1); \\ Michel Marcus, Sep 22 2022
(PARI) a(n, q=prime(n+1))=my(P=Mod(1, q), s=P); forprime(p=2, q-1, s+=P*=p); lift(s) \\ Charles R Greathouse IV, Sep 22 2022
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Christopher A. Curry, Sep 21 2022
STATUS
approved