OFFSET
1,1
COMMENTS
LINKS
J. Stauduhar, Table of n, a(n) for n = 1..10000
MATHEMATICA
Select[Range[145], EvenQ@ Total@ IntegerDigits@ # != EvenQ@ NestWhile[Total@ IntegerDigits@ # &, #, # > 9 &] &] (* Michael De Vlieger, Feb 03 2018 *)
PROG
(Python)
#Digital sum of n.
def ds(n):
if n < 10:
return n
return n % 10 + ds(n//10)
def A298638(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(A298638(100))
(PARI) isok(n) = sumdigits(n) % 2 != if (n, ((n-1)%9+1) % 2, 0); \\ Michel Marcus, Mar 01 2018
CROSSREFS
KEYWORD
nonn,easy,base
AUTHOR
J. Stauduhar, Jan 23 2018
STATUS
approved