login
Numbers whose base-3 representation Sum_{i=0..m} d(i)*3^i has d(m) < d(m-1) > d(m-2) < ...
3

%I #23 Jun 16 2024 01:38:13

%S 1,2,5,15,16,46,47,50,138,141,142,150,151,415,416,424,425,428,451,452,

%T 455,1245,1248,1249,1272,1275,1276,1284,1285,1353,1356,1357,1365,1366,

%U 3736,3737,3745,3746,3749,3817,3818,3826,3827

%N Numbers whose base-3 representation Sum_{i=0..m} d(i)*3^i has d(m) < d(m-1) > d(m-2) < ...

%C For any a(n) == 0 (mod 3), 3*a(n)+1 and 3*a(n)+2 are also in the sequence, but 3*a(n) is not. Likewise, for any a(n) == 2 (mod 3) -- except for a(2)=2 -- 3*a(n) and 3*a(n)+1 are in the sequence but 3*a(n)+2 is not. - _Christian N. K. Anderson_, May 21 2024

%H Christian N. K. Anderson, <a href="/A032841/b032841.txt">Table of n, a(n) for n = 1..10000</a>

%e The numbers {415, 416, 424, 425, 428, 451, 452, 455} are in the sequence because in base 3 they are {120101, 120102, 120201, 120202, 120212, 121201, 121202, 121212}; all the six-digit base-3 numbers that fit the pattern. - _Christian N. K. Anderson_, May 21 2024

%o (R)

%o updown.base<-function(base,ndig,curdig=1,diglist=rep(NA,ndig)) {

%o if(curdig>ndig) return(sum(base^(ndig:1-1)*diglist)); nextstep<-function(i) {diglist[curdig]=i; updown.base(base,ndig,curdig+1,diglist)}; if(curdig==1) return(sort(unlist(sapply(1:(base-2+(ndig==1)), nextstep)))); if(curdig%%2) return(sapply((diglist[curdig-1]-1):0, nextstep)); sapply((diglist[curdig-1]+1):(base-1), nextstep) }; sapply(1:10,function(nd) updown.base(3,nd)) # _Christian N. K. Anderson_, May 21 2024

%Y Cf. A032850 for digits <= or >= previous digit (also in base 3).

%Y Cf. A032842 for same sequence in base 4, A032843 base 5, A032844 base 6, A032845 base 7, A032846 base 8, A032847 base 9, A032848 base 10, and A032849 base 2.

%K nonn,base

%O 1,2

%A _Clark Kimberling_