OFFSET
1,2
COMMENTS
The last term of this sequence is a(111111111) = 999999999.
LINKS
Muniru A Asiru, Table of n, a(n) for n = 1..1111
EXAMPLE
300 belongs to the sequence since its initial digit is 3 and the number has three digits. 3001 does not belong to the sequence since its initial digit is 3, but the number has four digits in total.
MATHEMATICA
Select[Range[1000], IntegerDigits[#][[1]] == Length[IntegerDigits[#]] &] (* Alonso del Arte, Dec 24 2018 *)
PROG
(GAP) P:=List([1..340], ListOfDigits);;
a:=Filtered([1..Length(P)], i->P[i][1]=Size(P[i])); # Muniru A Asiru, Sep 26 2018
(PARI) is(n) = #digits(n)==digits(n)[1] \\ Felix Fröhlich, Sep 27 2018
(PARI) a(n, base=10) = for (w=1, oo, my (c=base^(w-#digits(w, base))); if (n<=c, return (c*w+n-1), n-=c)) \\ Rémy Sigrist, Dec 25 2018
(Python)
def ok(n): strn = str(n); return int(strn[0]) == len(strn)
def aupto(limit): return [m for m in range(1, limit+1) if ok(m)]
print(aupto(350)) # Michael S. Branicky, Jan 20 2021
CROSSREFS
KEYWORD
base,easy,nonn,fini
AUTHOR
Halfdan Skjerning, Sep 26 2018
STATUS
approved