# Enumeration of a certain sequence IV

Let $$F_n$$ denote the $$n$$-th Fibonacci number. I am interested in the sequence $$a(k, n)=\left | \left \{0 \leq m \leq n: \frac{F_m}{k} \; \text{is a perfect square} \right \} \right |,$$ where $$|\cdot|$$ denotes the cardinality of a set.

For example, $$a(1, 100) = 4$$ since there are only four perfect squares among the first $$n=100$$ Fibonnaci numbers: $$F_0=0$$, $$F_1=1$$, $$F_2=1$$ and $$F_{12}=144$$.

How can I write a code to calculate $$a(k, n)$$?

• What is perfect square? Jun 24, 2023 at 11:17
• @cvgmt, I think this is a common synonym for a square number. Jun 24, 2023 at 11:45
• @Domen I know Perfect triangle numbers etc. but I do not know Perfect square. Jun 25, 2023 at 0:14

You did not give an example. Is this what you want?

Using Michael E2 code to check for perfect square from Fastest square number test

ClearAll[a,sQ];
sQ[n_]:=FractionalPart@Sqrt[n+01]==0;
a[k_Integer,n_Integer?Positive]:=Table[f=Fibonacci[m]/k; If[sQ[f],m,Nothing],{m,0,n}];
a[1,100]


Length[%]
(*4*)

• I am sorry for the misunderstanding. The horizontal brackets denote cardinality. Jun 24, 2023 at 10:17
• $a(n,k)$ is essentially the number of integers $m$ less than $n$ such that $F_m/k$ is a perfect square. Jun 24, 2023 at 10:17
• @user227351 Ok, if all what you want is the number of integers $m$ that satisfy this, then simply it will be the length of the result. No? Will update. Jun 24, 2023 at 10:23
• I am not that competent, but SquareFreeQ ask "Is $n$ square free?" not "Is $n$ not a square?". Jun 24, 2023 at 10:25
• @user227351 could you check if this is now what you meant? Found a test for perfect square. So in this example, the length is 3. Jun 24, 2023 at 10:41