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.

A080471 a(n) is the smallest Fibonacci number that is obtained by placing digits anywhere in n; a(n) = n if n is a Fibonacci number.

This page as a plain text file.
%I A080471 #19 Jan 21 2023 01:59:34
%S A080471 1,2,3,34,5,610,377,8,89,610,4181,121393,13,144,1597,10946,1597,4181,
%T A080471 1597,832040,21,514229,233,2584,2584,28657,28657,2584,121393,832040,
%U A080471 317811,832040,233,34,3524578,46368,377,46368,121393,832040,4181,514229
%N A080471 a(n) is the smallest Fibonacci number that is obtained by placing digits anywhere in n; a(n) = n if n is a Fibonacci number.
%H A080471 Robert Israel, <a href="/A080471/b080471.txt">Table of n, a(n) for n = 1..10000</a>
%p A080471 IsSubList:= proc(T, S)
%p A080471   local i;
%p A080471   if T = [] then return true fi;
%p A080471   if S = [] then return false fi;
%p A080471   i:= ListTools:-Search(T[1],S);
%p A080471   if i = 0 then false else procname(T[2..-1],S[i+1..-1]) fi
%p A080471 end proc:
%p A080471 f:= proc(n) local T,S,k,v;
%p A080471    T:= convert(n,base,10);
%p A080471    for k from 1 do
%p A080471       v:= combinat:-fibonacci(k);
%p A080471       S:= convert(v,base,10);
%p A080471       if IsSubList(T,S) then return v fi
%p A080471    od
%p A080471 end proc:
%p A080471 map(f, [$1..100]); # _Robert Israel_, Mar 10 2020
%t A080471 a[n_] := Block[{p = RegularExpression[ StringJoin @@ Riffle[ ToString /@ IntegerDigits[ n], ".*"]], f, k=2}, While[! StringContainsQ[ ToString[f = Fibonacci[ k++]], p]]; f]; Array[a, 42] (* _Giovanni Resta_, Mar 10 2020 *)
%o A080471 (Python)
%o A080471 def dmo(n, t):
%o A080471     if t < n: return False
%o A080471     while n and t:
%o A080471         if n%10 == t%10:
%o A080471             n //= 10
%o A080471         t //= 10
%o A080471     return n == 0
%o A080471 def fibo(f=1, g=2):
%o A080471     while True: yield f; f, g = g, f+g
%o A080471 def a(n):
%o A080471     return next(f for f in fibo() if dmo(n, f))
%o A080471 print([a(n) for n in range(1, 77)]) # _Michael S. Branicky_, Jan 21 2023
%Y A080471 Cf. A068164, A068165, A080470.
%K A080471 base,nonn
%O A080471 1,2
%A A080471 _Amarnath Murthy_, Mar 07 2003
%E A080471 Corrected and extended by _Ray Chandler_, Oct 11 2003