# How Can I Find Five Numbers Between Two Numbers

Suppose I have these two numbers: 800000 and 3200000. I want to find five numbers with an even difference in between these two numbers. Therefore, I want the output to be:

``````800000
1200000
1600000
2000000
2400000
2800000
3200000
``````

I know about the `seq` command but I'm not sure how to do this.

• You need to specify the increment for `seq`. Use something like `\$(( (3200000 - 800000) / 6 ))` as your incremental value. Jun 16 at 17:39
• `seq 800000 \$(((3200000-800000)/6)) 3200000` Jun 16 at 17:43
• If the number of values does not divide exactly into the range, the spacing get rounded and the last value may not appear at all. Jun 16 at 19:04

Using `jot`:

``````\$ jot 7 800000 3200000
800000
1200000
1600000
2000000
2400000
2800000
3200000
``````

The `jot` utility is available by default on most BSD systems but may also be installed on, e.g., Debian GNU/Linux and Ubuntu Linux. The `apt` package containing `jot` seems to be called `athena-jot`.

• Thanks. On Gentoo, I installed the `jot` package. Jun 17 at 0:05

Using any awk in any shell on every Unix box:

``````\$ awk -v b=800000 -v e=3200000 -v n=5 'BEGIN{d=int((e-b)/(n+1)); for (i=b; i<e; i+=d) print i; print e}'
800000
1200000
1600000
2000000
2400000
2800000
3200000
``````