Consecutive Sum

Created on Nov. 8, 2024 by Julien Palard

Write a function named find_consecutive_sum that takes an integer n and returns a triplet of consecutive integers (a, b, c) such that a + b + c == n.

In case no such triplet exists, your function should return None.

Examples

>>> find_consecutive_sum(15)
(4, 5, 6)
>>> find_consecutive_sum(10)
None
  • There's no corrections yet, hit the `Submit` button to send your code to the correction bot.
  • Keyboard shortcuts:
    • Ctrl-Enter: Send your code to the correction bot.
    • Escape: Get back to the instructions tab.
(Ctrl-Enter)