A251853 Nonnegative numbers n with all even digits such that the digital sum of the digits' sum is even.
0, 2, 4, 6, 8, 20, 22, 24, 26, 40, 42, 44, 60, 62, 80, 200, 202, 204, 206, 220, 222, 224, 240, 242, 260, 400, 402, 404, 420, 422, 440, 488, 600, 602, 620, 668, 686, 688, 800, 848, 866, 868, 884, 886, 888, 2000, 2002, 2004, 2006, 2020, 2022, 2024, 2040, 2042, 2060, 2200
Offset: 1
Examples
2288 is in the sequence because it is even, 2 and 8 are even, 2 + 2 + 8 + 8 = 20 is even, and 2 + 0 = 2 is even.
Links
- Michael De Vlieger, Table of n, a(n) for n = 1..10000
Programs
-
Mathematica
a251853[n_Integer] := Module[{digitSum}, digitSum[x_] := Plus @@ IntegerDigits[x]; Select[Range[n], And[And @@ EvenQ@IntegerDigits[#], EvenQ@digitSum[#], EvenQ@Nest[digitSum, #, 2]] &]]; a251853[2200] (* Michael De Vlieger, Dec 11 2014 *)
-
PARI
isevend(v) = for (i=1, #v, if (v[i] % 2, return (0))); return (1); isok(n) = isevend(digits(n)) && ((sumdigits(sumdigits(n)) % 2) == 0); \\ Michel Marcus, Dec 11 2014
-
Python
A251853_list = [int(''.join(d)) for d in product('02468',repeat=4) if not sum(int(y) for y in str(sum(int(x) for x in d))) % 2] # Chai Wah Wu, Dec 20 2014
-
Sage
[x for x in [0..2200] if prod([is_even(i) for i in x.digits()]) and sum(Integer(sum(x.digits())).digits())%2==0] # Tom Edgar, Dec 10 2014
Formula
Each digit in n is divisible by two, n is divisible by 2, the sum S of the digits of n is divisible by 2, and the sum of the digits of S is also divisible by 2.