A298638 Numbers k such that the digital sum of k and the digital root of k have opposite parity.
19, 28, 29, 37, 38, 39, 46, 47, 48, 49, 55, 56, 57, 58, 59, 64, 65, 66, 67, 68, 69, 73, 74, 75, 76, 77, 78, 79, 82, 83, 84, 85, 86, 87, 88, 89, 91, 92, 93, 94, 95, 96, 97, 98, 99, 109, 118, 119, 127, 128, 129, 136, 137, 138, 139, 145, 146, 147, 148, 149, 154, 155
Offset: 1
Links
- J. Stauduhar, Table of n, a(n) for n = 1..10000
Programs
-
Mathematica
Select[Range[145], EvenQ@ Total@ IntegerDigits@ # != EvenQ@ NestWhile[Total@ IntegerDigits@ # &, #, # > 9 &] &] (* Michael De Vlieger, Feb 03 2018 *)
-
PARI
isok(n) = sumdigits(n) % 2 != if (n, ((n-1)%9+1) % 2, 0); \\ Michel Marcus, Mar 01 2018
-
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))
Comments