A061875 |First digit - second digit + third digit - fourth digit ...| = 6.
6, 17, 28, 39, 60, 71, 82, 93, 105, 116, 127, 138, 149, 170, 181, 192, 204, 215, 226, 237, 248, 259, 280, 291, 303, 314, 325, 336, 347, 358, 369, 390, 402, 413, 424, 435, 446, 457, 468, 479, 501, 512, 523, 534, 545, 556, 567, 578, 589, 600, 611, 622, 633, 644
Offset: 1
Links
- Harvey P. Dale, Table of n, a(n) for n = 1..1000
Programs
-
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 ] ] == 6, Print[ n ] ], {n, 1, 1000} ] Select[Range[700],Abs[Total[Times@@@Partition[Riffle[IntegerDigits[#],{1,-1},{2,-1,2}],2]]]==6&] (* Harvey P. Dale, May 21 2020 *)
-
Python
def ok(n): return abs(sum(int(d)*(-1)**i for i, d in enumerate(str(n))))==6 print(list(filter(ok, range(645)))) # Michael S. Branicky, Jun 17 2021