login
a(n) is the sum of the lengths of the base-b expansions of n for all b with 1 <= b <= n.
0

%I #24 Sep 23 2019 21:11:52

%S 1,4,7,11,14,17,20,24,28,31,34,37,40,43,46,51,54,57,60,63,66,69,72,75,

%T 79,82,86,89,92,95,98,102,105,108,111,115,118,121,124,127,130,133,136,

%U 139,142,145,148,151,155,158,161,164,167,170,173,176,179,182,185

%N a(n) is the sum of the lengths of the base-b expansions of n for all b with 1 <= b <= n.

%F a(n) = A043000(n) + n. - _A.H.M. Smeets_, Sep 23 2019

%e a(5) = 14 because 5 has the following representations in bases 1 to 5: 11111, 101, 12, 11, 10 giving a total length of 5+3+2+2+2 = 14.

%e a(12) = 37 because 12 in bases 1 through 12 is 1...1 (12 1's), 1100, 110, and for bases 4 through 12 we get a 2-digit number, for a total length of 12+4+3+9*2 = 37. - _N. J. A. Sloane_, Sep 23 2019

%o (Go)

%o package main

%o import (

%o "fmt"

%o "strconv"

%o )

%o func main() {

%o // Due to limitations in strconv, this will only work for the first 36 terms

%o for i := 1; i <= 36; i++ {

%o count := i

%o for base := 2; base <= i; base++ {

%o count += len(strconv.FormatInt(int64(i), base))

%o }

%o fmt.Printf("%d, ", count)

%o }

%o }

%o (PARI) a(n) = my(i=n); for(b=2, n, i+=#digits(n, b)); i \\ _Felix Fröhlich_, Sep 23 2019

%o (Python)

%o def count(n,b):

%o c = 0

%o while n > 0:

%o n, c = n//b, c+1

%o return c

%o n = 0

%o while n < 60:

%o n = n+1

%o a, b = n, 1

%o while b < n:

%o b = b+1

%o a = a + count(n,b)

%o print(n,a) # _A.H.M. Smeets_, Sep 23 2019

%Y Cf. A043000.

%K nonn,base

%O 1,2

%A _Steve Engledow_, Sep 23 2019

%E More terms from _Felix Fröhlich_, Sep 23 2019