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.

A161638 The largest number of steps in Euclid's algorithm applied to A157807(n) and A157813(n).

This page as a plain text file.
%I A161638 #22 Mar 17 2025 22:14:02
%S A161638 1,1,2,2,1,1,2,3,2,2,1,1,2,2,3,3,2,2,4,3,1,1,2,2,3,3,2,2,3,2,1,1,2,3,
%T A161638 3,2,3,4,4,3,2,2,4,3,1,1,2,2,2,4,2,3,5,3,3,3,2,2,4,4,3,3,1,1,2,3,2,3,
%U A161638 4,3,2,2,3,3,4,3,2,2,1,1,2,3,2,3,3,3,2
%N A161638 The largest number of steps in Euclid's algorithm applied to A157807(n) and A157813(n).
%C A161638 The sequence of fractions is ordered as follows: 1/1, 2/1, 1/2, 1/3, 3/1, 4/1, 3/2, 2/3, 1/4, 1/5, 5/1,...
%H A161638 Anonymous, <a href="http://eom.springer.de/E/e036320.htm">Euclidean algorithm</a>, Springer's Encyclopedia of Maths.
%H A161638 Eric W. Weisstein, <a href="https://mathworld.wolfram.com/EuclideanAlgorithm.html">Euclidean algorithm</a>, MathWorld.
%H A161638 Wikipedia, <a href="http://en.wikipedia.org/wiki/Euclid&#39;s_algorithm">Euclid's algorithm</a>
%e A161638 a(8) = 3 because the algorithm applied to the pair (2,3) needs the steps 2 = 3 x 0 + 2 then 3 = 2 x 1 + 1 and 2 = 1 x 2 + 0.
%o A161638 (Python)
%o A161638 from math import gcd
%o A161638 def euclid_steps(a, b):
%o A161638   if b == 0:
%o A161638     return 0
%o A161638   else:
%o A161638     return 1 + euclid_steps(b, a % b)
%o A161638 for s in range(2, 100, 2):
%o A161638   for i in range(1, s):
%o A161638     if gcd(i, s - i) != 1: continue
%o A161638     print(euclid_steps(i, s - i))
%o A161638   for i in range(s, 0, -1):
%o A161638     if gcd(i, s + 1 - i) != 1: continue
%o A161638     print(euclid_steps(i, s + 1 - i))
%o A161638 # _Hiroaki Yamanouchi_, Oct 06 2014
%K A161638 nonn,easy
%O A161638 1,3
%A A161638 _Yalcin Aktar_, Jun 15 2009
%E A161638 Partially edited by _R. J. Mathar_, Sep 23 2009
%E A161638 a(1) prepended and a(12)-a(87) added by _Hiroaki Yamanouchi_, Oct 06 2014