login
A216587
Preimage of n for A216556 (i.e., concatenation of digits of a(n), each increased by 1, yields n), -1 if there is none.
5
-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, 15, 16, 17, 18, -1, 20, 21, 22, 23, 24, 25, 26, 27, 28, -1, 30, 31, 32, 33, 34, 35, 36, 37, 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
OFFSET
0,4
COMMENTS
Also: Left inverse to A216556: A216587 o A216556 = id.
Sequence A216589 lists the indices n for which a(n)=-1, i.e., n is not in the range of A216556.
LINKS
E. Angelini, Strings resurrection, SeqFan mailing list, Sep 08 2012
FORMULA
a(A216556(n))=n for all n.
a(n)=n-1 for n < 11; a(n)=n-11 for 20 < n < 110 except n=30, 40, ..., 100.
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.
EXAMPLE
a(a(a(2127)))=a(a(1016))=a(905)=-1, since under A216556, 905 -> 1016 -> 2127, but no n yields A216556(n)=905.
PROG
(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}
CROSSREFS
See also A216557.
Sequence in context: A000030 A179635 A306354 * A174210 A134777 A253015
KEYWORD
sign,base,easy
AUTHOR
M. F. Hasler, Sep 09 2012
STATUS
approved