If we write 3n+1=(x+y)^2 and 2n+1=x^2, then we have the question reduced to algebraic quantities. If we expand the first equation we get 3n+1=x^2+2xy+y^2. To eliminate n and find a relationship between x and y, we need to multiply the first equation by 2 and the second by 3: 6n+2=2x^2+4xy+2y^2 and 6n+3=3x^2. If we subtract the former from the latter we get 1=x^2-4xy-2y^2, which we can write as a quadratic for y: 2y^2+4xy+1-x^2=0. From this we get:
y=(-4x+/-sqrt(16x^2-8+8x^2))/4 = (-2x+/-sqrt(6x^2-2))/2.
So x+y = +/-sqrt(6x^2-2)/2 or (x+y)^2=(3x^2-1)/2. We now have relationship between the perfect squares. If x =1 we can see that y=0 and n= 0. We can also appreciate that x must be odd because (3x^2-1) must be divisible by 2. When x=9, (3x^2-1)/2 = 121 = 11^2. 121-81=40, and 3n+1-(2n+1)=n must also be 40. So we have two values for n so far 0 and 40.