%I #11 Jan 02 2023 12:30:48
%S -1,0,1,2,3,4,5,6,7,8,9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,10,11,12,13,14,
%T 15,16,17,18,-1,20,21,22,23,24,25,26,27,28,-1,30,31,32,33,34,35,36,37,
%U 38,-1,40,41,42,43,44,45,46,47,48,-1,50,51,52,53,54,55,56,57,58,-1,60,61,62,63
%N Preimage of n for A216556 (i.e., concatenation of digits of a(n), each increased by 1, yields n), -1 if there is none.
%C Also: Left inverse to A216556: A216587 o A216556 = id.
%C Sequence A216589 lists the indices n for which a(n)=-1, i.e., n is not in the range of A216556.
%H E. Angelini, <a href="http://list.seqfan.eu/oldermail/seqfan/2012-September/010124.html">Strings resurrection</a>, SeqFan mailing list, Sep 08 2012
%F a(A216556(n))=n for all n.
%F a(n)=n-1 for n < 11; a(n)=n-11 for 20 < n < 110 except n=30, 40, ..., 100.
%F a(n)=-1 if n contains a substring "20", "30",..., "90" or "00", or if n starts with digits "11", "12", ..., "19". For all other n>1 one has a(n)>0.
%e a(a(a(2127)))=a(a(1016))=a(905)=-1, since under A216556, 905 -> 1016 -> 2127, but no n yields A216556(n)=905.
%o (PARI) A216587(n)={my(s=0);n!=1&for(i=1,#n=Vecsmall(Str(n)),n[i]>48||(i>1&n[i-1]==49&s=s\10+1)||return(-1);(s=s*10+n[i]-49)&next;(i<#n&n[i++]==48&s=9)||return(-1));s}
%Y See also A216557.
%K sign,base,easy
%O 0,4
%A _M. F. Hasler_, Sep 09 2012