A374026 a(n) = the smallest k such that Fibonacci(k) begins and ends with n, where Fibonacci(k) > n, or -1 if there are none.
22, 114, 124, 72, 10, 39, 116, 207, 169, 5715, 2428, 5634, 2366, 189, 2620, 4668, 3137, 2673, 5812, 12090, 721, 11583, 20086, 3798, 1975, 999, 10636, 846, 2071, 9105, 1162, 2076, 8287, 11091, 2770, 2928, 12943, 8493, 172, 2220, 5359, 4737, 28126, 11838, 10460, 7479, 10996
Offset: 1
Examples
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.
Programs
-
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
-
Python
# uses A023183() in A023183 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
Formula
a(n) >= max{A023183(n), A020344(n)} except that a(n) = -1 when A023183(n) = -1. - Michael S. Branicky, Jun 27 2024
Extensions
More terms from Michel Marcus, Jun 26 2024
Comments