>if and only if p is a Mersenne prime, i.e. 2^p-1 is prime, then ST(2^(p-1)) == 1 mod M(p)As pointed out at
https://www.cut-the-knot.org/do_you_know/triSquare.shtml, square triangular numbers can be obtained by squaring the members of the sequence generated by the recurrence relation
(i) u(n) = 6*u(n-1) - u(n-2), n > 1, u(0)=0, u(1)=1
Therefore the statement can be rephrased by saying that
(ii) iff 2^p-1 is a Mersenne prime then u(2^(p-1)) = 1 (mod 2^p-1).
What is important, I think, is that u(n) is a Fibonacci type sequence, and Fibonacci type sequences reduced modulo an integer are cyclic.
For example, if p=3, then 2^p-1=7, a Mersenne prime, and u(n) modulo 7 will be:
u(0)=0 (mod 7)
u(1)=1 (mod 7)
u(2)=6 (mod 7)
u(3)=0 (mod 7)
u(4)=1 (mod 7)
u(5)=6 (mod 7), etc.
The cycle length is 3, and u(2^(p-1))=u(4) = u(1) (mod 7).
In general, if the cycle length of u(n) reduced modulo q a prime is c, then
u(1+c)=u(1) mod q, that is u(1+c)=1 (mod q).
Therefore, if I am right, what we need to prove is that
(iii) the cycle length divides 2^(p-1)-1 .
Why? With c denoting the cycle length, if c divides 2^(p-1)-1, then, for an integer k, ck+1=2^(p-1), that is, as stated in (ii), u(2^(p-1)) = u(ck+1) = 1 (mod 2^p-1).
There is an article at https://www.damtp.cam.ac.uk/user/dv211/mathgaz06.pdf, written by Dominic Vella and Alfred Vella, discussing the cycle lengths of generalised Fibonacci sequences of the type
G(n) = a*G(n-1) + b*G(n-2).
It defines Delta as a^2+4b, and then states in Theorem 6 (I only changed the letter denoting the prime):
"If Delta is a quadratic residue modulo q then C(q) | (q-1)", where C(q) is the cycle length (modulo q).
For u(n), a=6, b=-1, therefore Delta=32.
32 is a quadratic residue modulo a Mersenne prime, because there is an integer x for which
x^2 = 32 (mod 2^p-1) where 2^p-1 is a Mersenne prime. This can be rephrased as saying that there is an integer k for which k*(2^p-1)+32 is square. Take k=32=2^5, then 32*(2^p-1)+32 = 2^(p+5). As 2^p-1 is a Mersenne prime, p is odd for p>2, and so 2^(p+5) is a square for p>2.
Therefore the cycle length of u(n) modulo a Mersenne prime 2^p-1 divides 2^p-2 = 2*(2^(p-1)-1). That proves (iii). That, I think, also proves the if part of the conjecture. I am not sure of the "only if" part.
I would be grateful for a confirmation whether this really proves the if part of the conjecture.
Andras Erszegi