login
a(n) is the sum of all positive integers whose digits in base n are strictly decreasing.
1

%I #14 Jan 12 2021 09:06:37

%S 0,3,40,495,6816,108255,1980672,41289759,968750080,25296994503,

%T 728148203520,22912992806847,782690956959744,28847447610890415,

%U 1141156999457800192,48228647947883167935,2168834125678237974528

%N a(n) is the sum of all positive integers whose digits in base n are strictly decreasing.

%H Reddit user blungbat, <a href="https://www.reddit.com/r/mathriddles/comments/it24bd/sum_of_numbers_with_descending_digits_ii/">Sum of numbers with descending digits II</a>, r/mathriddles, 2020.

%e In base n=3, a(3) is the sum of the base-3 numbers {1, 2, 10, 20, 21, 210}, which sum to 1+2+3+6+7+21 = 40.

%p rebase := proc(digs,b)

%p add( op(i,digs)*b^(i-1),i=1..nops(digs)) ;

%p end proc:

%p A337692 := proc(b)

%p local a,digs,len,p ;

%p a := 0 ;

%p digs := [seq(i,i=0..b-1)] ;

%p for len from 1 to b do

%p for p in permute(digs,len) do

%p if op(-1,p) <> 0 and sort(p) = p then

%p print(p) ;

%p a := a+rebase(p,b) ;

%p end if;

%p end do:

%p end do:

%p print() ;

%p a ;

%p end proc:

%p seq(A337692(n),n=1..8) ; # _R. J. Mathar_, Nov 20 2020

%K nonn,base

%O 1,2

%A _Jason Lang_, Sep 15 2020