Please read the new rule regarding the restriction on the use of AI tools. ×

Sum of alternating digits

Revision en1, by numbpy123, 2019-09-29 16:59:20

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).

Tags #number theory, #math

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English numbpy123 2019-09-29 16:59:20 785 Initial revision (published)