The answer is
4
Sufficiency:
Consider the colouring
Given a number represent it in base 3. Count trailing zeros, multiply the parity by two and add the least significant nonzero digit. The resulting number (1-4) is the colour.
Indeed if x and y are the same colour it is readily verified that z must have exactly one fewer trailing zero than the smaller number of trailing zeros between x and y.
Note that this is not the only way. For an alternative and arguably slightly simpler construction see comment by @EdwardH
Necessity:
Warmup: by-hand proof of a weaker bound to illustrate the technique.
Choosing x = z we see that pairs a,b=2a must have different colours and equating x and y that pairs 3a=2b must have different colours. Using all permutations of these two we see that 6 must be coloured differently to 3,4,9 and 12. But using x=3,y=9,z=4 we see that in addition to the colour of 6 at least two more are required.
Full proof: Computer generated, human readable.
Shown are 7 macro columns each consisting of four micro columns. The micro columns are the three colours plus annotation. Each row corresponds to painting one more number (top-to-bottom).
Annotations:
f=forced: this number could only be given the given colour.
w=wlog: at least two colours weren't used yet; pick one without loss of generality
b=branch: for this number at least two colours are still possible; the other branches are traced in new macro columns
c=contradiction: for this number no colour is available anymore.
As all branches end with contradictions three colours are not sufficient.
18| | w
24| | b |24| w
6| | b | 6| w | |12 f
| 8| w | |12 f | |36 f
| |12 f | | 9 f 16| | f
| | 4 f |27| f | 8| f
| |16 f | |54 f 6| | b | 6| b
|36| f |36| f | | 4 f | | 9 f
| |54 f | |14 f | 2| f |27| f
|27| f |30| f | | 3 f 54| | f
81| | f 15| | f | 9| f |30| b | |30 b
|30| b | |30 b 21|21|21 c |32| f 15| | f 45| | f
20| | f |14| f | | | |48 f | |10 f | | 3 f
22| | f | |10 f | | 72| | f | |11 f 4| | f
|32| f 15| | f | | |30| b | |30 b 17| | f 11| | f
|44| f | | 7 f | | 13| | f 11| | f 19| | f | 5| f
| |46 f | 9| f | | | 5| f 22|22|22 c 20| | f 7| | f
| |48 f |11| f | | 20| | f | | |23| f | |10 f
|34| f | |13 f | | | |10 f | | |25| f 17|17|17 c
| |14 f | |21 f | | | |11 f | | |26| f | |
|10| f 33|33|33 c | | 19|19|19 c | | | |13 f | |
21| | f | | | | | | | | 3| 3| 3 c | |
| |15 f | | | | | | | | | | | |
| 9| f | | | | | | | | | | | |
| |13 f | | | | | | | | | | | |
26| | f | | | | | | | | | | | |
72|72|72 c | | | | | | | | | | | |