OFFSET
1,1
COMMENTS
The Heron sequence of every number a(n) has the following relationship: numerator(h(k))^2 - a(n)*denominator(h(k))^2 = 1 for k > 1.
The Heron sequence of every number a(n) has the following relationship with the continued fraction f(s) convergent to sqrt(a(n)): h(k) = f(2^k-1).
From Gerhard Kirchner, Jan 17 2020: (Start)
Numbers k = m^2 + r with m > 0 and 0 < r <= 2m such that r is a divisor of 2m.
Continued fraction: k = [m; 2m/r, 2m, 2m/r, 2m, ...].
The number of terms that are between m^2 and (m+1)^2 is equal to the number of divisors of 2m, which is A099777(m).
Proof see link. The Maxima code below demonstrates the divisor property. Note that there is no divisor of 2m between m and 2m.
(End)
LINKS
Gerhard Kirchner, Divisor property of a(n)
EXAMPLE
The continued fraction of sqrt(6) = 2 + 1/(2 + 1/(4 + 1/(2 + 1/(4 + 1/(2 + 1/(4 + ...)))))) = [2; 2, 4, 2, 4, 2, 4, ...] has repeating portion (2, 4) with period 2, so 6 is a term.
MAPLE
Digits:=40: nr:=0:
for z from 2 to 200 do
test:=true: c:=sqrt(z):
if (c=floor(c)) the test:=false: end if:
while (test=true) do
b[0]:=floor(c):
r[0]:=c:
for k from 1 to 2 do
r[k]:=evalf(1/(r[k-1]-b[k-1])):
b[k]:=floor(r[k]):
end do:
if (b[1]=2*b[0]) or (b[2]=2*b[0]) then nr:=nr+1: a[nr]:=z: printf("%4d", z): end if:
test:=false:
end do:
end do:
MATHEMATICA
Select[Range[200], !IntegerQ[Sqrt[#]] && Length@ContinuedFraction[Sqrt[#]][[-1]]<3 &] (* Amiram Eldar, Nov 01 2018 *)
PROG
(Maxima)
block([n: 2, m: 0, r: 0, k: 0, kmax: 10, v: ""],
while k<kmax do
(m: floor(sqrt(n)), r: n-m^2,
if mod(2*m, r)=0 then (k: k+1, print(n)),
if r= m then n: n+m else (if r= 2*m then n: n+2 else n: n+1)));
/* Gerhard Kirchner, Jan 17 2020 */
CROSSREFS
KEYWORD
nonn
AUTHOR
Paul Weisenhorn, Oct 21 2018
EXTENSIONS
Edited by Jon E. Schoenfield, Oct 19 2019
STATUS
approved