numbpy123's blog

By numbpy123, history, 5 years ago, In English

Given a number N, if you write down all the numbers from 1..N and put alternating + and — signs between every digit, what's the value?

Note how I said between every digit and not between every number. For example, if N = 12, we get,

1 — 2 + 3 — 4 + 5 — 6 + 7 — 8 + 9 — 1 + 0 — 1 + 1 — 1 + 2 = 5.

I tried to look on OEIS for such sequences, and I had no luck. I've also tried rewriting it in many ways, etc, but I had no luck. I'm guessing you can just stimulate the process, but I'm pretty sure it would be very expensive (especially for large numbers where you need to obtain the kth digit of the number).

I was wondering if anyone has a solution better than mine (which is just stimulation).

  • Vote: I like it
  • -2
  • Vote: I do not like it

| Write comment?
»
5 years ago, # |
  Vote: I like it +4 Vote: I do not like it

Could you please tell the maximum value of N i.e. range of N.

»
5 years ago, # |
  Vote: I like it -9 Vote: I do not like it