OFFSET
1,2
FORMULA
EXAMPLE
a(12)=28 since 1234567891011121110987654321 has 28 digits.
PROG
(PARI)
a(n)={my(t=logint(n, 10)+1); 2*n*t-2*(10^t-1)/9+t}
(Python)
def a(n): return ((n*(t:=len(str(n)))-(10**t-1)//9)<<1) + t
print([a(n) for n in range(1, 64)]) # Michael S. Branicky, May 02 2023
CROSSREFS
KEYWORD
nonn,base
AUTHOR
David Cleaver, Apr 29 2023
STATUS
approved