OFFSET
1,1
COMMENTS
All terms == 4 or 7 (mod 11). - Robert Israel, Jun 03 2016
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
MAPLE
F:= proc(n) option remember;
-procname(floor(n/10)) + (n mod 10)
end proc:
for j from 0 to 9 do F(j):= j od:
select(abs @ F = 4, [$1..1000]); # Robert Israel, Jun 03 2016
MATHEMATICA
Do[ a = IntegerDigits[ n ]; l = Length[ a ]; e = o = {}; Do[ o = Append[ o, a[ [ 2k - 1 ] ] ], {k, 1, l/2 + .5} ]; Do[ e = Append[ e, a[ [ 2k ] ] ], {k, 1, l/2} ]; If[ Abs[ Apply[ Plus, o ] - Apply[ Plus, e ] ] == 4, Print[ n ] ], {n, 1, 1000} ]
PROG
(Python)
def ok(n): return abs(sum((-1)**i*int(d) for i, d in enumerate(str(n))))==4
print(list(filter(ok, range(456)))) # Michael S. Branicky, Apr 15 2021
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
Robert G. Wilson v, May 10 2001
STATUS
approved