In light of the update to OP, here's an approach by way of a mathematical formula.
(* f[x_Integer, y_Integer] := x*Power[10, Ceiling[Log[10, y]]] + y *)
update corrected function should be as follows:
f[x_Integer, y_Integer] := x*Power[10, Floor[Log[10, y]] + 1] + y
Now let's make some fake data (two sets of 10^5
64 bit integers):
xlist = RandomInteger[{-2^63, 2^63 - 1}, 10^5];
ylist = RandomInteger[{-2^63, 2^63 - 1}, 10^5];
Let's test the performance.
Thread[f[xlist, ylist]] // AbsoluteTiming // First
6.7900095
What about strings, as suggested by Peltio?
f2[x_Integer, y_Integer] := ToExpression[StringJoin[ToString[x], ToString[y]]]
Thread[f2[xlist, ylist]] // AbsoluteTiming // First
1.3400019
Better, but not by orders of magnitude. Will not save you if, as you say, you're working with millions of integers.
How about @kguler 's approach?
f3[x_Integer, y_Integer] := FromDigits[Join @@ IntegerDigits@{x, y}]
Thread[f3[xlist, ylist]] // AbsoluteTiming // First
1.0800015
Marginally better.
As we can see, the somewhat universal mathematical formula performs worst of all.
I have a hunch that packed arrays may improve performance, but it appears, that a 64-bit signed integer refuses to fit into a packed array. Also, the result would be at least of 128-bit integers. I'll think about it and update this answer if I come up with something.
x = 11
andy = 222
? $\endgroup$x=2.34
andy=0.45
. On top of that I don't think this question is related to Mathematica. $\endgroup$