login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A061870 Numbers such that |first digit - second digit + third digit - fourth digit ...| = 1. 28
1, 10, 12, 21, 23, 32, 34, 43, 45, 54, 56, 65, 67, 76, 78, 87, 89, 98, 100, 111, 120, 122, 131, 133, 142, 144, 153, 155, 164, 166, 175, 177, 186, 188, 197, 199, 210, 221, 230, 232, 241, 243, 252, 254, 263, 265, 274, 276, 285, 287, 296, 298, 320, 331, 340, 342 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,2
COMMENTS
Multiples of 11 plus or minus 1. If 11k+1 is a perfect square (see A219257) then a(n) is the square root of 11k+1. [Gary Detlefs, Feb 22 2010]
LINKS
Charles R Greathouse IV, Table of n, a(n) for n = 1..10000
EXAMPLE
120 is in the sequence since |1-2+0| = 1.
MATHEMATICA
fQ[n_] := Abs[Plus @@ (((-1)^Range[Floor[Log[10, n] + 1]])*IntegerDigits@n)] == 1; Select[ Range@342, fQ@# &]
PROG
(PARI) altsum(v)=sum(i=1, #v, v[i]*(-1)^i)
is(n)=abs(altsum(digits(n)))==1 \\ Charles R Greathouse IV, May 21 2014
(Python)
def ok(n): return abs(sum(int(di)*(-1)**i for i, di in enumerate(str(n)))) == 1
print([k for k in range(343) if ok(k)]) # Michael S. Branicky, Jan 26 2023
CROSSREFS
Subsequence of A175885.
Sequence in context: A366958 A341002 A175885 * A348056 A120001 A108703
KEYWORD
nonn,base,easy
AUTHOR
Robert G. Wilson v, May 10 2001
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 23 16:40 EDT 2024. Contains 371916 sequences. (Running on oeis4.)