login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A032841
Numbers whose base-3 representation Sum_{i=0..m} d(i)*3^i has d(m) < d(m-1) > d(m-2) < ...
3
1, 2, 5, 15, 16, 46, 47, 50, 138, 141, 142, 150, 151, 415, 416, 424, 425, 428, 451, 452, 455, 1245, 1248, 1249, 1272, 1275, 1276, 1284, 1285, 1353, 1356, 1357, 1365, 1366, 3736, 3737, 3745, 3746, 3749, 3817, 3818, 3826, 3827
OFFSET
1,2
COMMENTS
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
LINKS
Christian N. K. Anderson, Table of n, a(n) for n = 1..10000
EXAMPLE
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
PROG
(R)
updown.base<-function(base, ndig, curdig=1, diglist=rep(NA, ndig)) {
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
CROSSREFS
Cf. A032850 for digits <= or >= previous digit (also in base 3).
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.
Sequence in context: A336385 A146109 A146108 * A058221 A349734 A146122
KEYWORD
nonn,base
STATUS
approved