OFFSET
0,4
MATHEMATICA
nxt[{n_, a_, b_}]:=Module[{k=1}, While[!CoprimeQ[k*b+a, n+1], k++]; {n+1, b, k*b+a}]; NestList[nxt, {1, 0, 1}, 40][[;; , 2]] (* Harvey P. Dale, Jun 04 2023 *)
PROG
(PARI) ar(n)=local(r, m); r=vector(n); r[1]=0; r[2]=1; for(k=2, n-1, m=1; while(gcd(m*r[k]+r[k-1], k)>1, m++); r[k+1]=m*r[k]+r[k-1]); r
CROSSREFS
KEYWORD
nonn
AUTHOR
Franklin T. Adams-Watters, Feb 05 2012
STATUS
approved