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 A308431 #9 May 28 2019 19:31:23 %S A308431 0,2,1,6,5,9,8,11,10,10,9,12,11,14,13,11,10,15,14,12,11,14,13,18,17, %T A308431 15,14,19,18,21,20,10,9,22,21,11,10,13,12,17,16,14,13,18,17,20,19,15, %U A308431 14,21,20,16,15,18,17,21,20,19,18,22,21,24,23,14,13,25,24 %N A308431 For any Gaussian integer z, let f(z) = z / (1+i) when z is a multiple of 1+i and f(z) = z+1 otherwise (where i denotes the imaginary unit). a(n) gives the number of iterations of the map f, starting with n, needed to reach a cycle. %C A308431 Iterating the map f always ends in one of the following cycles: (0) or (-i, -i+1). %C A308431 We can build a variant of this sequence by replacing the constant 1+i appearing in the name by any Gaussian integer, say d, such that gcd(Re(d), Im(d)) = 1 and norm(d) > 1. %C A308431 This sequence has similarities with A061313. %H A308431 Rémy Sigrist, <a href="/A308431/a308431.png">Colored representation of the number of iterations of the map f, starting with x+i*y, needed to reach a cycle for x = -500..+500 and y = -500..+500</a> %H A308431 Rémy Sigrist, <a href="/A308431/a308431_1.png">Colored representation of the variant where d = 2-i</a> %e A308431 For n = 4: %e A308431 - 4 is a multiple of 1+i, hence f(4) = 4/(1+i) = 2-2*i, %e A308431 - 2-2*i is a multiple of 1+i, hence f(2-2*i) = (2-2*i)/(1+i) = -2*i, %e A308431 - -2*i is a multiple of 1+i, hence f(-2*i) = -2*i/(1+i) = -1-i, %e A308431 - -1-i is a multiple of 1+i, hence f(-1-i) = (-1-i)/(1+i) = -1, %e A308431 - -1 is not multiple of 1+i, hence f(-1) = -1+1 = 0, %e A308431 - 0 belongs to the cycle (0), hence a(4) = 5. %o A308431 (PARI) a(z) = for (k=0, oo, if (z==0||z==-I||z==-I+1, return (k), if ((real(z)+imag(z))%2, z++, z/=(1+I)))) %Y A308431 Cf. A061313. %K A308431 nonn %O A308431 0,2 %A A308431 _Rémy Sigrist_, May 26 2019