login
A061871
|First digit - second digit + third digit - fourth digit ...| = 2.
1
2, 13, 20, 24, 31, 35, 42, 46, 53, 57, 64, 68, 75, 79, 86, 97, 101, 112, 123, 130, 134, 141, 145, 152, 156, 163, 167, 174, 178, 185, 189, 196, 200, 211, 222, 233, 240, 244, 251, 255, 262, 266, 273, 277, 284, 288, 295, 299, 310, 321, 332, 343, 350, 354, 361
OFFSET
1,1
COMMENTS
All terms == 2 or 9 (mod 11). - Robert Israel, Dec 23 2025
LINKS
FORMULA
Conjecture: a(n) ~ k*n sqrt(log n) for some k. Possibly the constant is sqrt(1650*Pi)/(18*sqrt(log(10))). - Charles R Greathouse IV, Jan 01 2026
MAPLE
filter:= proc(n) local L, i;
L:= convert(n, base, 10);
abs(add((-1)^i*L[i], i=1..nops(L)))=2
end proc:
select(filter, [$1..1000]); # Robert Israel, Dec 23 2025
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 ] ] == 2, Print[ n ] ], {n, 1, 1000} ]
A061871Q[k_] := Abs[Total[#*PadRight[{}, Length[#], {1, -1}]]] == 2 & [IntegerDigits[k]];
Select[Range[500], A061871Q] (* Paolo Xausa, Jan 10 2026 *)
PROG
(Python)
def ok(n): return abs(sum(di*(-1)**i for i, di in enumerate(map(int, str(n))))) == 2
print([k for k in range(365) if ok(k)]) # Michael S. Branicky, Dec 23 2025
KEYWORD
nonn,base,easy
AUTHOR
Robert G. Wilson v, May 10 2001
STATUS
approved