login
Largest Fibonacci factor of n.
7

%I #22 May 06 2024 11:04:30

%S 1,2,3,2,5,3,1,8,3,5,1,3,13,2,5,8,1,3,1,5,21,2,1,8,5,13,3,2,1,5,1,8,3,

%T 34,5,3,1,2,13,8,1,21,1,2,5,2,1,8,1,5,3,13,1,3,55,8,3,2,1,5,1,2,21,8,

%U 13,3,1,34,3,5,1,8,1,2,5,2,1,13,1,8,3,2,1,21,5,2,3,8,89,5,13,2,3,2,5,8,1,2,3,5

%N Largest Fibonacci factor of n.

%H Charles R Greathouse IV, <a href="/A054494/b054494.txt">Table of n, a(n) for n = 1..10000</a>

%F a(n) = n/A054495(n).

%e a(10)=5 because 1, 2 and 5 are the Fibonacci numbers which divide 10 and 5 is the largest.

%t With[{fibs=Fibonacci[Range[20]]},Table[Max[Select[fibs,Divisible[ n,#]&]],{n,100}]] (* _Harvey P. Dale_, Jul 17 2012 *)

%o (PARI) A010056(n)=my(k=n^2); k+=(k+1)<<2; issquare(k) || (n>0 && issquare(k-8))

%o a(n)=fordiv(n,d,if(A010056(n/d), return(n/d))) \\ _Charles R Greathouse IV_, Nov 05 2014

%o (Python)

%o from sympy import divisors

%o from sympy.ntheory.primetest import is_square

%o def A054494(n): return next(d for d in sorted(divisors(n,generator=True),reverse=True) if is_square(m:=5*d**2-4) or is_square(m+8)) # _Chai Wah Wu_, May 06 2024

%Y Cf. A000045, A005086, A010056, A054495.

%Y Sequences with similar definitions: A047930 (smallest Fibonacci multiple), A280686 (restricted to proper divisors), A280694 (equivalent for Lucas numbers).

%Y Positions of 1's: A147956.

%K easy,nonn

%O 1,2

%A _Henry Bottomley_, Apr 04 2000

%E Corrected by _Harvey P. Dale_, Jul 17 2012