OFFSET
1,2
LINKS
Michael De Vlieger, Table of n, a(n) for n = 1..10000
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.
EXAMPLE
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.
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 *)
PROG
(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
(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
(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
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Chase Fortier, Dec 09 2014
STATUS
approved