info prev up next book cdrom email home


The concatenation of two strings $a$ and $b$ is the string $ab$ formed by joining $a$ and $b$. Thus the concatenation of the strings ``book'' and ``case'' is the string ``bookcase''. The concatenation of two strings $a$ and $b$ is often denoted $ab$, $a\vert\vert b$, or, in Mathematica ${}^{\scriptstyle\circledRsymbol}$ (Wolfram Research, Champaign, IL), $a<>b$. Concatenation is an associative operation, so that the concatenation of three or more strings, for example $abc$, $abcd$, etc., is well-defined.

The concatenation of two or more numbers is the number formed by concatenating their numerals. For example, the concatenation of 1, 234, and 5678 is 12345678. The value of the result depends on the numeric base, which is typically understood from context.

The formula for the concatenation of numbers $p$ and $q$ in base $b$ is

p\vert\vert q=pb^{l(q)}+q,


l(q) = \left\lfloor{\log_b q}\right\rfloor +1

is the Length of $q$ in base $b$ and $\left\lfloor{x}\right\rfloor $ is the Floor Function.

See also Consecutive Number Sequences, Length (Number), Smarandache Sequences

© 1996-9 Eric W. Weisstein