|
|
A064690
|
|
Define a sequence of fractions by x(m+1) = (x(m)^2+x(m)-1)/(x(m)+1) with x(0)=1; sequence gives values of k such that sgn(x(k))<>sgn(x(k-1)).
|
|
1
|
|
|
2, 4, 7, 11, 13, 22, 23, 332, 560, 565, 566, 568, 616, 618, 1161, 1163, 1167, 1194, 1298, 1317, 1321, 1329, 1360, 1370, 1371, 1373, 1374, 1376, 1386, 1391, 1503, 1506, 1081319, 1081322, 1081349, 1081353, 1081356, 1081358, 1081363, 1081365, 1081367, 1081376, 1081379
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,1
|
|
LINKS
|
|
|
EXAMPLE
|
x(0)=1, x(1) = 1/2, x(2) = -1/6 so a(1) = 2 because sgn(x(1)) <> sgn(x(2)).
|
|
MAPLE
|
x := 1;
for n from 1 do
xold := x;
x := x-1/(x+1) ;
if x*xold < 0 then
print(n) ;
end if;
|
|
PROG
|
(Python)
from itertools import count, islice
def A064690_gen(): # generator of terms
ap, aq, sa = 1, 1, True
for n in count(1):
if (r:=ap+aq) > 0:
bq = aq*r
bp = ap*r-aq**2
else:
bq = -aq*r
bp = aq**2-ap*r
if (sa is not (sb:=bp>0)):
yield n
ap, aq, sa = bp, bq, sb
(PARI) A64690=List(); m64690=0; x64690=1.; A064690(n)={while(n>#A64690, until(sign(x64690)!=sign(x64690-=1/(x64690+1)), m64690++); listput(A64690, m64690)); A64690[n]} \\ Precision must be set to twice the number of desired terms: correct up to a(21) with standard precision \p38, up to a(56) with \p99, up to a(104) with \p199. - M. F. Hasler, Jul 24 2023
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
Jonathan Ayres (jonathan.ayres(AT)btinternet.com), Oct 16 2001
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|