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.

A228247 Number of primitive solutions of t(x,n) - s(x,n) = 2, where s(x,n) and t(x,n) are the number of applications of the classical and modified Euclidean algorithms needed to convert (x,n) to gcd(x,n).

This page as a plain text file.
%I A228247 #7 Jul 31 2019 23:18:12
%S A228247 0,0,0,0,0,0,0,1,0,0,2,0,1,2,1,1,2,1,3,2,0,2,5,2,1,4,2,3,4,1,5,3,4,6,
%T A228247 5,1,1,6,5,4,4,3,7,8,1,7,9,4,5,6,4,5,6,6,10,6,5,6,8,4,7,9,7,7,8,6,6,
%U A228247 12,10,10,11,3,5,7,8,11,6,11,13,10,4,7,15
%N A228247 Number of primitive solutions of t(x,n) - s(x,n) = 2, where s(x,n) and t(x,n) are the number of applications of the classical and modified Euclidean algorithms needed to convert (x,n) to gcd(x,n).
%C A228247 The classical Euclidean algorithm uses the mapping u(x,y) = (y, (x mod y)).  In much the same way, the modified Euclidean algorithm, introduced here, uses the mapping v(x,y) = (y, y-(x mod y)).  Specifically, suppose that (x,y) is an ordered pair of positive integers.  Let s(x,y) be the number of applications of u, starting with (x,y)->u(x,y), needed to reach ( . , g), where g = gcd(x,y), and let t(x,y) be the number of applications of v, starting with (x,y)->v(x,y), to reach ( . , g).
%C A228247 For fixed d >= 0, if t(x,y)-s(x,y) = d, then t(x+k*y,y)-s(x+k*y,y) = d for all k>=0.  Thus, for any such (x,y), there is a least m for which t(m,y)-s(m,y) = d.  The pair (m,y) is called a primitive solution of t(x,y)-s(x,y) = d.  Let c(n) be the number of primitive solutions of the equation t(x,n)-s(x,n) = d.
%C A228247 For d = 0, (c(n)) = (0,1,0,1,1,1,2,2,1,3,1,2,2,3,2,5,...)
%C A228247 For d = 1, (c(n)) = (1,1,2,2,3,3,3,3,4,4,3,6,4,4,6,4,...)
%C A228247 For d = 2, (c(n)) = (0,0,0,0,0,0,0,1,0,0,2,0,1,2,1,1,...) = A228247
%C A228247 For d > 0, (c(n)) = (1,1,2,2,3,3,3,4,4,4,5,6,5,6,7,5,...)
%C A228247 For d >=0, (c(n)) = (1,2,2,3,4,4,5,6,5,7,6,8,7,9,9,10,...)
%C A228247 Records are set by (x,y) = (F(n+1),F(n)), where F = A000045 (Fibonacci numbers).
%H A228247 Clark Kimberling, <a href="/A228247/b228247.txt">Table of n, a(n) for n = 1..1000</a>
%e A228247 a(19) = 3 counts the primitive solutions (31,19), (33,19), (34,19).  Applications of the classical and modified Euclidean algorithms are indicated here:
%e A228247 (31,19)->(19,12)->(12,7)->(7,5)->(5,2)->(2,1), so s(31,19) = 5;
%e A228247 (31,19)->(19,7)->(7,2)->(2,1), so t(31,19) = 3 and d(31,19) = 2.
%e A228247 (33,19)->(19,4)->(14,5)->(5,4)->(4,1), so s(33,19) = 4;
%e A228247 (33,19)->(19,5)->(5,1), so t(33,19)=2, so t(33,19) = 2 and d(33,19) = 2.
%e A228247 (34,19)->(19,15)->(15,4)->(4,3)->(3,1), so s(34,19) = 4;
%e A228247 (34,19)->(19,4)->(4,1), so t(34,19) = 2 and d(34,19 = 2.  All other x for which d(x,19) = 2 are nonprimitive, so that a(19) = 3.
%t A228247 f[{b_, c_}] := {c, Mod[b, c]}; f1[{b_, c_}] := {c, c - Mod[b, c]}; ans = Select[Flatten[Table[{Length[NestWhileList[f, #, #[[2]] > 0 &]] - Length[NestWhileList[f1, #, ! #[[1]] == #[[2]] &]], #} &[{b, c}], {c, 1, #}, {b, c, #}], 1] &[250], #[[1]] > 0 &]; sorted = Map[{#[[1]], Reverse[#[[2]]]} &, Sort[Map[{#[[1]], Reverse[#[[2]]]} &, ans]]];
%t A228247 groupA = Select[sorted, #[[2]][[1]] < 2 #[[2]][[2]] &];
%t A228247 SplitBy[groupA, #[[2]][[2]] &] // TableForm; z = 200;
%t A228247 Map[Count[groupA, {1, {_, #}}] &, Range[z]]  (* d = 1 *)
%t A228247 Map[Count[groupA, {2, {_, #}}] &, Range[z]]  (* d = 2; A228247 *)
%t A228247 Map[Count[groupA, {3, {_, #}}] &, Range[z]]  (* d = 3 *)
%t A228247 Map[Count[groupA, {_, {_, #}}] &, Range[z]]  (* d > 0 *)
%t A228247 (* _Peter J. C. Moses_, Aug 12 2013 *)
%Y A228247 Cf. A000045.
%K A228247 nonn,easy
%O A228247 1,11
%A A228247 _Clark Kimberling_, Aug 18 2013