A086378 Sum of successive remainders in computing Euclidean algorithm for (1,1/sqrt(n)) is rational.
1, 2, 4, 6, 9, 12, 16, 20, 25, 30, 36, 42, 49, 55, 56, 64, 70, 72, 81, 90, 100, 110, 121, 132, 144, 153, 155, 156, 169, 180, 182, 196, 210, 225, 240, 256, 272, 289, 305, 306, 324, 342, 361, 377, 380, 400, 420, 441, 462, 484, 504, 505, 506, 529, 546, 552, 576, 600
Offset: 1
Keywords
Examples
7137 is in the sequence because kappa(1/sqrt(7137)) = 7/1098 (in Q).
Programs
-
Mathematica
kappa[n_] := Module[{a, b, i, p}, If[(a = Sqrt[n] - Floor[Sqrt[n]]) == 0, Return[0]]; i = a = Simplify[1/a]; p = 1; b = 0; Do[p = Simplify[a*p]; b = Simplify[a*b - Floor[a] + a]; If[(a = Simplify[1/(a - Floor[a])]) == i, Break[]], {Infinity}]; Return[Simplify[(1/a + b/(p-1))/Sqrt[n], Sqrt]]]; Reap[For[n = 1, n <= 600, n++, If[Element[kappa[n], Rationals], Print[n]; Sow[n]]]][[2, 1]] (* Jean-François Alcover, Apr 15 2017, translated from MuPAD *)
-
MuPAD
kappa_1_over_sqrt := proc(n) local a,b,i,p; begin if (a := sqrt(n)-isqrt(n)) = 0 then return(0) end_if: i := a := simplify(1/a,sqrt); p := 1; b := 0; repeat p := simplify(p*a,sqrt); b := simplify(b*a+a-floor(a),sqrt); until (a := simplify(1/(a-floor(a)),sqrt)) = i end_repeat: return(simplify((b/(p-1) + 1/a)/sqrt(n),sqrt)); end_proc:
Extensions
Edited by Franklin T. Adams-Watters, Nov 30 2011
Comments