This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A226636 #35 Jul 10 2022 13:23:55 %S A226636 5,7,11,13,15,19,21,29,31,33,37,39,45,55,57,63,83,85,87,91,93,99,109, %T A226636 111,117,135,163,165,171,189,245,247,249,253,255,261,271,273,279,297, %U A226636 325,327,333,351,405,487,489,495,513,567,731,733,735,739,741,747,757 %N A226636 Numbers whose base-3 sum of digits is 3. %C A226636 All of the entries are odd. %C A226636 Subsequence of A005408. - _Michel Marcus_, Sep 03 2013 %C A226636 In general, the set of numbers with sum of base-b digits equal to b is a subset of { (b-1)*k + 1; k = 2, 3, 4, ... }. - _M. F. Hasler_, Dec 23 2016 %H A226636 Robert Israel, <a href="/A226636/b226636.txt">Table of n, a(n) for n = 1..10000</a> %F A226636 a(k^3/6 + k^2 + 5*k/6 + j) = 3^(k+1) + A055235(j-1) for 1 <= j <= k^2/2+5*k/2+2. - _Robert Israel_, Jun 05 2018 %e A226636 The ternary expansion of 5 is (1,2), which has sum of digits 3. %e A226636 The ternary expansion of 31 is (1,0,0,2), which has sum of digits 3. %e A226636 10 is not on the list since the ternary expansion of 10 is (1,0,1), which has sum of digits 2 not 3. %p A226636 N:= 10: # for all terms < 3^(N+1) %p A226636 [seq(seq(seq(3^a+3^b+3^c, c=0..`if`(b=a, b-1,b)),b = 0..a),a=0..N)]; # _Robert Israel_, Jun 05 2018 %t A226636 Select[Range@ 757, Total@ IntegerDigits[#, 3] == 3 &] (* _Michael De Vlieger_, Dec 23 2016 *) %o A226636 (Sage) [i for i in [0..1000] if sum(Integer(i).digits(base=3))==3] %o A226636 (PARI) select( is(n)=sumdigits(n,3)==3, [1..999]) \\ _M. F. Hasler_, Dec 23 2016 %o A226636 (Python) %o A226636 from itertools import islice %o A226636 def nextsod(n, base): %o A226636 c, b, w = 0, base, 0 %o A226636 while True: %o A226636 d = n%b %o A226636 if d+1 < b and c: %o A226636 return (n+1)*b**w + ((c-1)%(b-1)+1)*b**((c-1)//(b-1))-1 %o A226636 c += d; n //= b; w += 1 %o A226636 def A226636gen(sod=3, base=3): # generator of terms for any sod, base %o A226636 an = (sod%(base-1)+1)*base**(sod//(base-1))-1 %o A226636 while True: yield an; an = nextsod(an, base) %o A226636 print(list(islice(A226636gen(), 57))) # _Michael S. Branicky_, Jul 10 2022, generalizing the code by _M. F. Hasler_ in A052224 %Y A226636 Cf. A018900, A023694, A055235, A187813. %Y A226636 Cf. A226969 (b = 4), A227062 (b = 5), A227080 (b = 6), A227092 (b = 7), A227095 (b = 8), A227238 (b = 9), A052224 (b = 10). %K A226636 nonn,base %O A226636 1,1 %A A226636 _Tom Edgar_, Aug 31 2013