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

%I #33 Aug 02 2023 13:57:48

%S 2,4,7,11,13,22,23,332,560,565,566,568,616,618,1161,1163,1167,1194,

%T 1298,1317,1321,1329,1360,1370,1371,1373,1374,1376,1386,1391,1503,

%U 1506,1081319,1081322,1081349,1081353,1081356,1081358,1081363,1081365,1081367,1081376,1081379

%N 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)).

%H Hugo Pfoertner, <a href="/A064690/b064690.txt">Table of n, a(n) for n = 1..1191</a>

%H Sean A. Irvine <a href="https://github.com/archmageirvine/joeis/blob/master/src/irvine/oeis/a064/A064690.java">Java program</a> (github)

%H Hugo Pfoertner, <a href="/A064690/a064690.png">x values plotted against m</a>.

%e x(0)=1, x(1) = 1/2, x(2) = -1/6 so a(1) = 2 because sgn(x(1)) <> sgn(x(2)).

%p x := 1;

%p for n from 1 do

%p xold := x;

%p x := x-1/(x+1) ;

%p if x*xold < 0 then

%p print(n) ;

%p end if;

%p end do: # _R. J. Mathar_, Jul 23 2023

%o (Python)

%o from itertools import count, islice

%o def A064690_gen(): # generator of terms

%o ap, aq, sa = 1, 1, True

%o for n in count(1):

%o if (r:=ap+aq) > 0:

%o bq = aq*r

%o bp = ap*r-aq**2

%o else:

%o bq = -aq*r

%o bp = aq**2-ap*r

%o if (sa is not (sb:=bp>0)):

%o yield n

%o ap, aq, sa = bp, bq, sb

%o A064690_list = list(islice(A064690_gen(),7)) # _Chai Wah Wu_, Jul 24 2023

%o (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

%K nonn

%O 1,1

%A Jonathan Ayres (jonathan.ayres(AT)btinternet.com), Oct 16 2001

%E a(13) onward corrected by _Sean A. Irvine_ and _Hugo Pfoertner_, Jul 23 2023

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 May 3 17:26 EDT 2024. Contains 372222 sequences. (Running on oeis4.)