OFFSET
1,1
COMMENTS
Since the smallest number beginning and ending with n is the same n, the condition that Fibonacci(k) > n is imposed. Partial overlap of the start and end is allowed, but not full overlap.
FORMULA
a(n) >= max{A023183(n), A020344(n)} except that a(n) = -1 when A023183(n) = -1. - Michael S. Branicky, Jun 27 2024
EXAMPLE
As Fibonacci(22) = 17711 is the smallest Fibonacci number greater than 1 that begins and ends with 1, a(1) = 22.
As Fibonacci(10) = 55 is the smallest Fibonacci number greater than 5 that begins and ends with 5, a(5) = 10.
PROG
(PARI) isok(s, t) = my(ss=strsplit(s, t)); (#ss >= 3) && (ss[1]=="") && (ss[#ss]=="");
a(n) = my(k=7); while(!isok(Str(fibonacci(k)), Str(n)), k++); k; \\ Michel Marcus, Jun 26 2024
from itertools import count
def a(n):
if A023183(n) == -1:
return -1
f, g, s = 1, 2, str(n)
pow10 = 10**len(s)
for k in count(3):
if g%pow10 == n:
sfib = str(g)
if g > n and sfib.startswith(s):
return k
f, g = g, f+g
print([a(n) for n in range(1, 51)]) # Michael S. Branicky, Jul 03 2024
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Gonzalo MartÃnez, Jun 26 2024
EXTENSIONS
More terms from Michel Marcus, Jun 26 2024
STATUS
approved