This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A377092 #34 Apr 19 2025 18:01:55 %S A377092 0,1,-1,2,3,-2,-3,-4,4,5,6,7,-6,-5,-7,-8,-9,-10,11,8,9,10,-11,-12,-13, %T A377092 -14,-15,-16,-17,17,12,13,14,15,16,18,19,20,21,22,23,24,25,26,27,28, %U A377092 -27,-19,-18,-20,-21,-22,-23,-24,-25,-26,-28,-29,-30,-31,-32,-33 %N A377092 a(0) = 0, and for any n > 0, a(n) is the least integer (in absolute value) not yet in the sequence such that the absolute difference of a(n-1) and a(n) is a Fibonacci number (A000045); in case of a tie, preference is given to the positive value. %C A377092 Will every integer appear in the sequence? %H A377092 Rémy Sigrist, <a href="/A377092/b377092.txt">Table of n, a(n) for n = 0..10000</a> %H A377092 Rémy Sigrist, <a href="/A377092/a377092.png">Scatterplot of the first 50000 terms of the partial sums</a> %H A377092 Rémy Sigrist, <a href="/A377092/a377092.gp.txt">PARI program</a> %e A377092 The first terms are: %e A377092 n a(n) |a(n)-a(n-1)| %e A377092 --- ----- --------------- %e A377092 0 0 N/A %e A377092 1 1 1 %e A377092 2 -1 2 %e A377092 3 2 3 %e A377092 4 3 1 %e A377092 5 -2 5 %e A377092 6 -3 1 %e A377092 7 -4 1 %e A377092 8 4 8 %e A377092 9 5 1 %e A377092 10 6 1 %e A377092 11 7 1 %e A377092 12 -6 13 %e A377092 13 -5 1 %e A377092 14 -7 2 %e A377092 The first terms are a(0) = 0, a(1) = 1 and a(2) = -1, clearly the |smallest| unused number so far, which yields |a(2)-a(1)| = 2, a Fibonacci number. - _M. F. Hasler_, Feb 21 2025 %t A377092 A377092list[nmax_] := Module[{s, a, u = 1, fibQ}, %t A377092 fibQ[n_] := fibQ[n] = (IntegerQ[Sqrt[# + 4]] || IntegerQ[Sqrt[# - 4]]) & [5*n^2]; %t A377092 s[_] := False; s[0] = True; %t A377092 NestList[(While[s[u] && s[-u], u++]; a = u; While[s[a] || !fibQ[Abs[# - a]], a = Boole[a < 0] - a]; s[a] = True; a) &, 0,nmax]]; %t A377092 A377092list[100] (* _Paolo Xausa_, Apr 19 2025 *) %o A377092 (PARI) \\ See Links section. %o A377092 (PARI) A377092_upto(N, U=[-1])={vector(N, n, if(n>1, for(k=U[1]+1,oo, A010056(k-N) && !setsearch(U, k) && [N=k, break]), N=0); U=setunion(U,[N]); while(#U>1&&U[1]+1==U[2],U=U[^1]); N)} \\ _M. F. Hasler_, Feb 21 2025 %o A377092 (Python) %o A377092 def A377092(n): %o A377092 if not getattr(A := A377092, 'N', 0): A.N = 1; A.terms = [0] %o A377092 while len(A.terms) <= n: %o A377092 while (k := A.N) in A.terms: A.N = (k<0)-k %o A377092 while not A010056(abs(k - A.terms[-1])) or k in A.terms: k = (k<0)-k %o A377092 A.terms.append(k) %o A377092 return A.terms[n] # _M. F. Hasler_, Feb 10 2025 %Y A377092 Cf. A000045, A377090, A377091, A380320 (first differences), A380321 (partial sums). %Y A377092 Cf. A010056 (characteristic function of the Fibonacci numbers). %K A377092 sign %O A377092 0,4 %A A377092 _Rémy Sigrist_, Oct 16 2024