A085004 a(n)=2*A085003(n)-n.
1, 2, 1, 0, -1, 0, 1, 0, -1, -2, -1, 0, 1, 0, -1, 0, 1, 2, 1, 0, 1, 2, 3, 2, 1, 0, 1, 2, 1, 0, -1, 0, 1, 2, 1, 0, 1, 2, 3, 2, 1, 2, 3, 4, 3, 2, 1, 2, 3, 2, 1, 0, 1, 2, 1, 0, -1, 0, 1, 2, 1, 0, 1, 2, 3, 2, 1, 0, 1, 2, 1, 0, -1, 0, 1, 0, -1, -2, -1, 0, 1, 0, -1, 0, 1, 2, 1, 0, -1, 0, 1, 0, -1, -2, -1, 0, -1, -2, -3, -2, -1, 0, -1, -2, -1, 0, 1, 0, -1, 0, 1, 2, 1, 0, -1
Offset: 1
Keywords
Programs
-
PARI
2*sum(k=1, n, (k+sqrtint(5*k^2))%4>1)-n \\ Charles R Greathouse IV, Feb 07 2013
Formula
|a(n+1)-a(n)| = 1. - Charles R Greathouse IV, Feb 07 2013