OFFSET
1,1
COMMENTS
All of the entries are odd.
Subsequence of A005408. - Michel Marcus, Sep 03 2013
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
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
FORMULA
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
EXAMPLE
The ternary expansion of 5 is (1,2), which has sum of digits 3.
The ternary expansion of 31 is (1,0,0,2), which has sum of digits 3.
10 is not on the list since the ternary expansion of 10 is (1,0,1), which has sum of digits 2 not 3.
MAPLE
N:= 10: # for all terms < 3^(N+1)
[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
MATHEMATICA
Select[Range@ 757, Total@ IntegerDigits[#, 3] == 3 &] (* Michael De Vlieger, Dec 23 2016 *)
PROG
(Sage) [i for i in [0..1000] if sum(Integer(i).digits(base=3))==3]
(PARI) select( is(n)=sumdigits(n, 3)==3, [1..999]) \\ M. F. Hasler, Dec 23 2016
(Python)
from itertools import islice
def nextsod(n, base):
c, b, w = 0, base, 0
while True:
d = n%b
if d+1 < b and c:
return (n+1)*b**w + ((c-1)%(b-1)+1)*b**((c-1)//(b-1))-1
c += d; n //= b; w += 1
def A226636gen(sod=3, base=3): # generator of terms for any sod, base
an = (sod%(base-1)+1)*base**(sod//(base-1))-1
while True: yield an; an = nextsod(an, base)
print(list(islice(A226636gen(), 57))) # Michael S. Branicky, Jul 10 2022, generalizing the code by M. F. Hasler in A052224
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Tom Edgar, Aug 31 2013
STATUS
approved