OFFSET
1,2
COMMENTS
For a real number x, take (a_0,b_0) = (1,x), then (a_(i+1),b_(i+1)) = (b_i,a_i-b_i*floor(a_i/b_i)), for i>=0 and call kappa(x) = b_1+b_2+b_3+... If kappa(1/sqrt(n)) is rational (which can be easily evaluated thanks to the periodicity of the process for a quadratic number), then n is in the sequence.
An infinity of 2nd degree polynomial functions take all their values over N in the sequence (such as x^2, x^2+x, 36*x^2+17*x+2, 100*x^2+150*x+55, 196*x^2+97*x+12, ...).
EXAMPLE
7137 is in the sequence because kappa(1/sqrt(7137)) = 7/1098 (in Q).
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 *)
PROG
(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:
CROSSREFS
KEYWORD
nonn
AUTHOR
Thomas Baruchel, Sep 02 2003
EXTENSIONS
Edited by Franklin T. Adams-Watters, Nov 30 2011
STATUS
approved