Пожалуйста, прочтите новое правило об ограничении использования AI-инструментов. ×

Блог пользователя numbpy123

Автор numbpy123, история, 5 лет назад, По-английски

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

  • Проголосовать: нравится
  • -2
  • Проголосовать: не нравится

»
5 лет назад, # |
  Проголосовать: нравится +4 Проголосовать: не нравится

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

»
5 лет назад, # |
  Проголосовать: нравится -9 Проголосовать: не нравится