login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
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
Sean A. Irvine Java program (github)
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;
end do: # R. J. Mathar, Jul 23 2023
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
A064690_list = list(islice(A064690_gen(), 7)) # Chai Wah Wu, Jul 24 2023
(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
Sequence in context: A345983 A177754 A086795 * A138766 A192638 A211372
KEYWORD
nonn
AUTHOR
Jonathan Ayres (jonathan.ayres(AT)btinternet.com), Oct 16 2001
EXTENSIONS
a(13) onward corrected by Sean A. Irvine and Hugo Pfoertner, Jul 23 2023
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified July 14 18:01 EDT 2024. Contains 374322 sequences. (Running on oeis4.)