OFFSET
0,4
COMMENTS
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
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
KEYWORD
sign,base,easy
AUTHOR
M. F. Hasler, Sep 09 2012
STATUS
approved