In the August 2003 issue of his monthly recreational mathematics column, Math Magic, Erich Friedmann introduces the concept of Snumbers. These are numbers where an expression can be given, using the operations of addition and squaring, using the digits of a number in order, which gives the original number. For example
As a notational convenience he proposes that brackets be used to denote the squaring operation, giving
This can be generalised and formalised as follows:
A positive, nonzero, integer, number is an SNumber in base b, for functions f(x) and g(x,y) if given a sequence a_{0} ... a_{n} there is a sequence of substitutions x®f(x) and x,y®g(x,y) giving an expression whose value is Σa_{i}b^{ni}.
Erich Friedmann poses some questions as to the density of these numbers, and suggests investigation of f(x)=x^{n}, f(x)=x!, g(x,y)=x+y, and g(x,y)=x×y.
Notationally, we can denote g(x,y) as x·y, giving
(If g(x,y) is not associative the use of (x) to denote f(x) and x·y to denote g(x,y) is problematical, as we'd also need to use parentheses to specify the order of evaluation.
This problem can be investigated both experimentally (i.e. with the aid of a computer) and analytically. I have treated this problem primarily as a programming (optimisation) exercise, but have also found some theorems, mostly used to eliminate numbers for the computational search.
I have investigated the following classes of function for f(x)

I have only investigated g(x,y)=x×y.
I have restricted investigation of functions f(x) to those functions in which f(x) ³ x. Without this restriction it is not possible to ascertain a priori whether the sequence of substitutions can be terminated. In general a similar restriction would be applied to g(x,y), but in the case g(x,y)=x×y, where g(0,y)=g(x,0)=0, it can be neglected with the observation that, provided f(0)=0, then for any number with a zero digit any expression has value zero, and cannot be an Snumber for b, f(x) and g(x,y). Perhaps one should assert g(f(x),y) ³ g(x,y) and g(x,f(y)) ³ g(x,y)