Consider a base n rational number α.β and it's reverse form β.α such that their product is an integer.
For example, in base ten: (3.5)*(5.3)= 18.55, which is NOT an integer.
Consider all positive integer bases n ≤ 36 and determine all valid triplets (α, β, n) of positive integers for which the product of (α.β)base n and (β.α)base n is an integer.
Now the harder part, looking for solutions with A and B nonzero.
From the problem statement we have (A+B/N)*(B+A/N)=P with all A,B,N,P integers and 0<A<N and 0<B<N.
Multiply by N^2 and distribute to get A*B*N^2+A^2*N+B^2*N+A*B = P*N^2 (Eq1) Taking this equation mod N then gives us A*B = 0 mod N. Let C be the value that makes A*B=C*N.
Subsitute that into Eq1 and simplify bit to get A^2+B^2+C = N*(P-A*B). The useful part of this equation is taking mod N to have A^2+B^2+C = 0 mod N.
With A and B being less than N and C*N=A*B this means C is less than A and B. Wlog, assume B is less than A; then we can create the compound inequaity C<B<A<N. This also implies that N>=4, C<=N-3 and B<=sqrt(C*N).
Combining this information suggests a search algorithm: for a given N, take C=1 to N-3 and look for factorizations of C*N into A*B that satisfy A^2+B^2+C = 0 mod N.
This UBASIC program does the search (but still does not convert A or B to base N digits):
5 print=print+"output.txt"
10 for N=4 to 36
20 for C=1 to N-3
30 for B=(C+1) to floor(sqrt(C*N))
40 A=(C*N)B
50 if res>0 then 100
70 if (A*A+B*B+C)@N>0 then 100
80 print "(";A;B;N;")"
100 next B
110 next C
120 next N
140 print=print
150 end
Results:
( 5 2 10 )
( 10 7 14 )
( 16 12 24 )
( 13 6 26 )
( 12 7 28 )
( 24 14 28 )
( 15 10 30 )
( 22 15 30 )
( 22 3 33 )
These results match up with the non-zero solutions in Charlie's direct search
Edited on April 15, 2022, 6:48 pm