Open Rules

Run Sum

Count each digit once when a neighbour along the line differs by 1. These digits add up to the clue.

Parameters

Parameter Meaning Default
cells The marked cells, for example r1c1-r1c2-r2c2. Required.
sum The total the digits or values must add up to. Required.

Maths

Class: with aggregates.

The shared predicates define the notation and every named predicate.

countRun(cells)=sum

Sum each position once when at least one neighbouring position on the line differs by exactly 1. This sum equals sum.

Example

---
format: open-rules
title: Run Sum example
setter: Example
source: ""
case: ""
library: https://rules.sudoku-sleuth.com/
status: read
---

```rules
sudoku 9x9
run-sum r1c1-r1c2-r1c3 sum 6
```

Satisfies the rule: r1c1=1, r1c2=2, r1c3=3. All three consecutive-run digits contribute to total 6.

Breaks the rule: r1c1=1, r1c2=2, r1c3=5. A digit outside the run leaves the wrong contributing total.