login
A361508
a(n) = smallest k such that Fibonacci(k) = n, or -1 if n is not a Fibonacci number.
1
0, 1, 3, 4, -1, 5, -1, -1, 6, -1, -1, -1, -1, 7, -1, -1, -1, -1, -1, -1, -1, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 11
OFFSET
0,3
MATHEMATICA
Module[{nn=11, fibs}, fibs=Fibonacci[Range[nn]]; Join[{0}, Drop[Flatten[Table[If[MemberQ[ fibs, n], Position[fibs, n], -1], {n, Range[Last[fibs]]}]], {2}]]] (* Harvey P. Dale, May 13 2023 *)
PROG
(Python)
from sympy import log, ceiling, sqrt, S
from sympy.ntheory.primetest import is_square
def A361508(n): return n if n<=1 else (ceiling(log(n*sqrt(5)-S.Half, (1+sqrt(5))/2)) if is_square(m:=5*n**2-4) or is_square(m+8) else -1) # Chai Wah Wu, Mar 30 2023
CROSSREFS
Sequence in context: A300084 A321624 A079529 * A299022 A298532 A133779
KEYWORD
sign
AUTHOR
N. J. A. Sloane, Mar 30 2023
STATUS
approved