It is legal in form 001.example.com, you can add a hostname 001 as a record on DNS server and you will be able to ping and work with 001.example.com, I'm not sure if any *nix service will fail to work with that, it is according to standards and they should all support it, but you will have problems when omitting the domain.
$ ping 001.example.com
Pinging 001.example.com [127.0.0.5] with 32 bytes of data:
For instance ping, traceroute and many other tools will for 001 return an IP representation of the decimal number, which in this case is 0.0.0.1
$ ping 001
Pinging 0.0.0.1 with 32 bytes of data:
PING: transmit failed. General failure.
PING: transmit failed. General failure.
PING: transmit failed. General failure.
PING: transmit failed. General failure.
Highest number you can go that way is 30064771070 which represents 255.255.255.254
ping 30064771070
Pinging 255.255.255.254 with 32 bytes of data:
$ ping 30064771071
Ping request could not find host 30064771071. Please check the name and try again.
For number 30064771071 it will fail as it represents 255.255.255.255, and for numbers 30064771072 and higher it will resolve to IP if the hostname exists, for smaller numbers it always tries IP representation of the decimal number
$ ping 30064771072
Pinging 30064771072 [127.0.0.4] with 32 bytes of data:
Reply from 127.0.0.4: bytes=32 time<1ms TTL=128
Reply from 127.0.0.4: bytes=32 time<1ms TTL=128
There was a similar question on UNIX SE