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.

A266394 Square array a(n,k) is the number of terms in the "continued fraction" of the form -k1 + 1/(k2 - 1/(k3 -1/( ... for the fraction -k/n.

Original entry on oeis.org

1, 4, 2, 7, 1, 3, 10, 5, 5, 4, 13, 4, 1, 2, 5, 16, 8, 6, 8, 6, 6, 19, 7, 8, 1, 6, 3, 7, 22, 11, 4, 7, 11, 2, 7, 8, 25, 10, 9, 5, 1, 5, 9, 4, 9, 28, 14, 11, 11, 8, 14, 7, 7, 8, 10, 31, 13, 7, 4, 9, 1, 9, 2, 3, 5, 11, 34, 17, 12, 10, 9, 9, 17, 9, 12, 10, 9, 12
Offset: 1

Views

Author

Michel Marcus, Dec 29 2015

Keywords

Comments

a(n,k) is the number of steps to reach 0 for the fraction -k/n in the following process: if the fraction f is positive, it is replaced by 1/f; and if it is negative, it is replaced by f+1.

Examples

			a(1, 3) is the number of steps for -3/1: -3 -> -2 -> -1 -> 0 = 3 steps.
a(3, 1) is the number of steps for -1/3: -1/3 -> 2/3 -> -3/2 -> -1/2 -> 1/2 -> -2 -> -1 -> 0 = 7 steps.
The array begins:
   1, 2, 3, 4,  5, ...
   4, 1, 5, 2,  6, ...
   7, 5, 1, 8,  6, ...
  10, 4, 6, 1, 11, ...
  13, 8, 8, 7,  1, ...
  ...
		

Crossrefs

Cf. A000012 (diagonal), A016777 (1st column), A168230 (2nd line).

Programs

  • PARI
    trans(f) = if (f > 0, -1/f, if (f < 0, f+1, f));
    count(f) = nb = 0; while(f!=0, f = trans(f); nb++); nb;
    tabl(nn) = {for (n=1, nn, for (k=1, nn, print1(count(-k/n), ", ");); print(););}