Find a numeric coincidence when representing numbers in various bases Recently, when doing some code-golf challenge, I came up with with two solutions, in 69 and 105 bytes. It's a remarkable coincidence, because:


69 (decimal) = 105 (octal)
69 (hexadecimal) = 105 (decimal)


What other numbers have this property (using different bases)? You should help me answer this question!

Write a program or a subroutine that receives as input 3 numbers (base1, base2, base3, in ascending order), and prints two sequences of digits d1 d2 d3 ... and D1 D2 D3 ... that reproduce this numerical coincidence for the specified bases.

To make sure the various fine points are covered:


Evaluate one sequence as a number in base base1, and the other sequence in base base2 -- you must get the same number
Evaluate one sequence as a number in base base2, and the other sequence in base base3 -- you must get the same number
Both sequences must have finite length, which is greater than 1
Separate the sequences of digits with whitespace or in any other unambiguous way
Output to stdout or other similar output device
All digits must be between 0 and base-1; leading zeros are not allowed
If a digit is greater than 9, use a or A for 10, b for 11, ..., z for 35
You may assume that all bases are different, come in ascending order and are in the range 2...36; are represented in the most natural way for your language
If there is no answer, your code must signal it in some way (e.g. outputting nothing)
If there is an answer whose larger number is less than 1679616 (364), your code must find it; otherwise, it may output as if no solution exists
Code-golf: shortest code wins!


Example input:


8, 10, 16


Example output:


69 105


or


104 68


Or any other solution.

I'll be happy if you provide theoretical insights into this problem (How to determine whether a solution exists? Is there an infinite number of solutions?).
Python 2, 158 bytes

Came a bit too easily, so I might be missing something obvious!

s=lambda n,b:(n/b and s(n/b,b)or'')+chr(48+n%b+39*(n%b&gt;9))
def f(a,b,c):
 for n in range(b,36**4):
  x=s(n,a);y=s(n,b)
  if int(x,b)==int(y,c):print x,y;break


The base conversion function is lovingly stolen from @ugoren's solution to Print integers in any base up to 36. The code simply tries all possible values for the smaller number and the rest is fully determined. We start counting from base2 to ensure both sequences are at least length 2.

&gt;&gt;&gt; f(8, 10, 16)
100 64
&gt;&gt;&gt; f(8, 10, 17)
&gt;&gt;&gt; f(16, 20, 24)
20 1c