OFFSET
1,3
COMMENTS
LINKS
J. Stauduhar, Table of n, a(n) for n = 1..10000
MATHEMATICA
fQ[n_] := Mod[Plus @@ IntegerDigits@n, 2] == Mod[Mod[n -1, 9] +1, 2]; fQ[0] = True; Select[ Range[0, 104], fQ] (* Robert G. Wilson v, Jan 26 2018 *)
PROG
(Python)
#Digital sum of n.
def ds(n):
if n < 10:
return n
return n % 10 + ds(n//10)
def A298639(term_count):
seq = []
m = 0
n = 1
while n <= term_count:
s = ds(m)
r = ((m - 1) % 9) + 1 if m else 0
if s % 2 == r % 2:
seq.append(m)
n += 1
m += 1
return seq
print(A298639(100))
(PARI) dr(n)=if(n, (n-1)%9+1);
isok(n) = (sumdigits(n) % 2) == (dr(n) % 2); \\ Michel Marcus, Jan 26 2018
(PARI) is(n)=bittest(sumdigits(n)-(n-1)%9, 0)||!n \\ M. F. Hasler, Jan 26 2018
CROSSREFS
KEYWORD
nonn,easy,base
AUTHOR
J. Stauduhar, Jan 26 2018
STATUS
approved