OFFSET
2,1
COMMENTS
Multiplying n by a simple continued fraction with an increasing number of 1's sandwiched between n generates fractions that have a leading term x in their continued fraction, where x is obviously > n^2. We increase the number of 1's until the first and the last term in the simple terminating continued fraction of n*[n,1,...,1,n] =[x,...,x] is the same, x, and set a(n) to the count of these 1's.
Conjecture: the fixed points of this sequence are in A000057.
We have [n,1,1,...,1,n] = n + (n*Fib(m)+Fib(m-1))/(n*Fib(m+1)+Fib(m)) and n*[n,1,1,...,1,n] = n^2 + 1 + (n^2-n-1)*Fib(m)/(n*Fib(m+1)+Fib(m)), where m is the number of 1's. - Max Alekseyev, Aug 09 2012
REFERENCES
A. Hurwitz, Über die Kettenbrüche, deren Teilnenner arithmetische Reihen bilden, Vierteljahrsschrift der Naturforschenden Gesellschaft in Zürich, Jahrg XLI, 1896, Jubelband II, S. 34-64.
LINKS
FORMULA
Conjecture: a(n)=A001177(n)-1.
EXAMPLE
3* [3,1,1,1,3] = [10,1,10],so a(3)=3
4* [4,1,1,1,1,1,4] = [18,2,18],so a(4)=5
5* [5,1,1,1,1,5] = [28,28],so a(5)=4
6* [6,1,1,1,1,1,1,1,1,1,1,1,6] = [39,1,2,2,2,1,39], so a(6)=11
7* [7,1,1,1,1,1,1,1,7] = [53,3,53], so a(7)=7
MAPLE
A213648 := proc(n)
local h, ins, c ;
for ins from 1 do
c := [n, seq(1, i=1..ins), n] ;
h := numtheory[cfrac](n*simpcf(c), quotients) ;
if op(1, h) = op(-1, h) then
return ins;
end if;
end do:
end proc: # R. J. Mathar, Jul 06 2012
MATHEMATICA
f[m_, n_] := Block[{c, k = 1}, c[x_, y_] := ContinuedFraction[x FromContinuedFraction[Join[{x}, Table[m, {y}], {x}]]]; While[First@ c[n, k] != Last@ c[n, k], k++]; k]; f[1, #] & /@ Range[2, 67] (* Michael De Vlieger, Sep 16 2015 *)
PROG
(PARI) {a(n) = local(t, m=1); if( n<2, 0, while( t = contfracpnqn( concat( [n, vector(m, i, 1 ), n])), t = contfrac( n * t[1, 1] / t[2, 1]); if( t[1] < n^2 || t[#t] < n^2, m++, break)); m)} /* Michael Somos, Jun 17 2012 */
(PARI) {a(n) = local(t, m=0); if( n<2, 0, until(t[1]==t[#t], m++; t = contfrac(n^2 + 1 + (n^2-n-1)*fibonacci(m)/(n*fibonacci(m+1)+fibonacci(m))); ); m )} /* Max Alekseyev, Aug 09 2012 */
CROSSREFS
KEYWORD
nonn
AUTHOR
Art DuPre, Jun 17 2012
STATUS
approved