login
Numbers k such that the digital sum of k and the digital root of k have opposite parity.
3

%I #35 Sep 25 2023 14:51:40

%S 19,28,29,37,38,39,46,47,48,49,55,56,57,58,59,64,65,66,67,68,69,73,74,

%T 75,76,77,78,79,82,83,84,85,86,87,88,89,91,92,93,94,95,96,97,98,99,

%U 109,118,119,127,128,129,136,137,138,139,145,146,147,148,149,154,155

%N Numbers k such that the digital sum of k and the digital root of k have opposite parity.

%C Numbers k such that A113217(k) <> A179081(k).

%C Complement of A298639.

%C Agrees with A291884 until a(46): a(46) = 109 is not in that sequence.

%H J. Stauduhar, <a href="/A298638/b298638.txt">Table of n, a(n) for n = 1..10000</a>

%t Select[Range[145], EvenQ@ Total@ IntegerDigits@ # != EvenQ@ NestWhile[Total@ IntegerDigits@ # &, #, # > 9 &] &] (* _Michael De Vlieger_, Feb 03 2018 *)

%o (Python)

%o #Digital sum of n.

%o def ds(n):

%o if n < 10:

%o return n

%o return n % 10 + ds(n//10)

%o def A298638(term_count):

%o seq = []

%o m = 0

%o n = 1

%o while n <= term_count:

%o s = ds(m)

%o r = ((m - 1) % 9) + 1 if m else 0

%o if s % 2 != r % 2:

%o seq.append(m)

%o n += 1

%o m += 1

%o return seq

%o print(A298638(100))

%o (PARI) isok(n) = sumdigits(n) % 2 != if (n, ((n-1)%9+1) % 2, 0); \\ _Michel Marcus_, Mar 01 2018

%Y Cf. A007953, A010888, A113217, A179081.

%Y Cf. A298639, A291884.

%K nonn,easy,base

%O 1,1

%A _J. Stauduhar_, Jan 23 2018