cp's OEIS Frontend

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.

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.

Original entry on oeis.org

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, 15, 14, 19, 18, 21, 20, 10, 9, 22, 21, 11, 10, 13, 12, 17, 16, 14, 13, 18, 17, 20, 19, 15, 14, 21, 20, 16, 15, 18, 17, 21, 20, 19, 18, 22, 21, 24, 23, 14, 13, 25, 24
Offset: 0

Views

Author

Rémy Sigrist, May 26 2019

Keywords

Comments

Iterating the map f always ends in one of the following cycles: (0) or (-i, -i+1).
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.
This sequence has similarities with A061313.

Examples

			For n = 4:
- 4 is a multiple of 1+i, hence f(4) = 4/(1+i) = 2-2*i,
- 2-2*i is a multiple of 1+i, hence f(2-2*i) = (2-2*i)/(1+i) = -2*i,
- -2*i is a multiple of 1+i, hence f(-2*i) = -2*i/(1+i) = -1-i,
- -1-i is a multiple of 1+i, hence f(-1-i) = (-1-i)/(1+i) = -1,
- -1 is not multiple of 1+i, hence f(-1) = -1+1 = 0,
- 0 belongs to the cycle (0), hence a(4) = 5.
		

Crossrefs

Cf. A061313.

Programs

  • 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))))