cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A023183 a(n) = least k such that Fibonacci(k) ends with n, or -1 if there are none.

This page as a plain text file.
%I A023183 #28 Jul 03 2024 07:18:58
%S A023183 0,1,3,4,9,5,21,14,6,11,15,22,216,7,111,130,168,37,27,112,60,8,117,64,
%T A023183 198,25,99,136,204,29,105,88,174,13,9,70,222,43,93,172,30,41,63,124,
%U A023183 12,55,21,154,186,49,75,148,36,67,129,10,162,23,87,118,180,61,57,166,72,20
%N A023183 a(n) = least k such that Fibonacci(k) ends with n, or -1 if there are none.
%C A023183 It appears that if n is greater than 99 and congruent to 4 or 6 (mod 8) then there is no Fibonacci number ending in that n. - _Jason Earls_, Jun 19 2004
%C A023183 This is because there is no Fibonacci number == 4 or 6 (mod 8). - _Robert Israel_, Sep 11 2020
%H A023183 Robert Israel, <a href="/A023183/b023183.txt">Table of n, a(n) for n = 0..9999</a>
%p A023183 V:= Array(0..999,-1):
%p A023183 V[0]:= 0: u:= 1: v:= 0:
%p A023183 for n from 1 to 1500 do
%p A023183   t:= v;
%p A023183   v:= u+v mod 1000;
%p A023183   u:= t;
%p A023183   if V[v] = -1 then V[v]:= n fi;
%p A023183   if V[v mod 100] = -1 then V[v mod 100] := n fi;
%p A023183   if V[v mod 10] = -1 then V[v mod 10]:= n fi;
%p A023183 od:
%p A023183 seq(V[i],i=0..999); # _Robert Israel_, Sep 11 2020
%t A023183 d[n_]:=IntegerDigits[n]; Table[j=0; While[Length[d[Fibonacci[j]]]<(le=Length[y=d[n]]), j++]; i=j; While[Take[d[Fibonacci[i]],-le]!=y,i++]; i,{n,0,65}] (* _Jayanta Basu_, May 18 2013 *)
%o A023183 (Python)
%o A023183 from itertools import count
%o A023183 def A023183(n):
%o A023183     if n < 2: return n
%o A023183     if n > 99 and n%8 in {4, 6}: return -1
%o A023183     k, f, g, s = 3, 1, 2, str(n)
%o A023183     pow10, seen = 10**len(s), set()
%o A023183     while (f, g) not in seen:
%o A023183         seen.add((f, g))
%o A023183         if g%pow10 == n:
%o A023183             return k
%o A023183         f, g, k = g, (f+g)%pow10, k+1
%o A023183     return -1
%o A023183 print([A023183(n) for n in range(66)]) # _Michael S. Branicky_, Jun 27 2024
%Y A023183 Cf. A000045, A023184, A020344, A020345.
%K A023183 sign,base,look
%O A023183 0,3
%A A023183 _David W. Wilson_