login
Nonnegative numbers n with all even digits such that the digital sum of the digits' sum is even.
1

%I #56 Feb 22 2018 16:05:09

%S 0,2,4,6,8,20,22,24,26,40,42,44,60,62,80,200,202,204,206,220,222,224,

%T 240,242,260,400,402,404,420,422,440,488,600,602,620,668,686,688,800,

%U 848,866,868,884,886,888,2000,2002,2004,2006,2020,2022,2024,2040,2042,2060,2200

%N Nonnegative numbers n with all even digits such that the digital sum of the digits' sum is even.

%H Michael De Vlieger, <a href="/A251853/b251853.txt">Table of n, a(n) for n = 1..10000</a>

%F 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.

%e 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.

%t 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 *)

%o (PARI) isevend(v) = for (i=1, #v, if (v[i] % 2, return (0))); return (1);

%o isok(n) = isevend(digits(n)) && ((sumdigits(sumdigits(n)) % 2) == 0); \\ _Michel Marcus_, Dec 11 2014

%o (Sage)

%o [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

%o (Python)

%o 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

%Y Cf. A007953, A014263, A054683.

%K nonn,base

%O 1,2

%A _Chase Fortier_, Dec 09 2014