[Question]
  [
**Challenge**
Given a sequence of numbers, create a function which returns the sequence steps.
* Assume a sequence will be `N >= 3`
* Sequence will repeat it steps at least once
* Sequence will only contain natural numbers
* Your function or program should return the shortest possible sequence of steps
**Example:**
Input: `[1, 2, 3, 5, 6, 7, 9, 10, 11, 13, 14, 15, 17]`
Output: `[1, 1, 2]`
**Explanation:** The initial sequence goes from `1 => 2 (1 step), 2 => 3 (1 step), 3 => 5 (2 steps)`. Then it repeats. The output then is `[1 step, 1 step, 2 steps] => [1, 1, 2]`
**Another example:**
Input: `[2, 5, 6, 7, 8, 11, 12, 13, 14, 17, 18, 19, 20]`
Output: `[3, 1, 1, 1]`
```
[2, 5, 6, 7, 8, 11, 12, 13, 14, 17, 18, 19, 20]
 \  /\ /\ /\ / 
  3   1  1  1  Then it repeats...
```
**Test Cases**
`Input: [1, 4, 8, 9, 10, 13, 17, 18, 19, 22, 26, 27, 28] => Output: [3,4,1,1]`
`Input: [6, 11, 13, 18, 20, 25, 27, 32, 34, 39, 41] => Output: [5,2]`
`Input: [2, 6, 10, 13, 17, 21, 25, 28, 32, 36, 40, 43, 47] => Output: [4,4,3,4]`
`Input: [5, 6, 7] => Output: [1]`
---
**Clarifications**
* The input length - 1 is divisible by the output length
* Assume sequence will always going to be increasing
---
This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), so the shortest answer in bytes win.
  
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), ~~9~~ 7 bytes
```
IsJEƇḢḢ
```
[Try it online!](https://tio.run/##XY@xDcIwEEV7prgBrsidHccMgBCsYLmkQemoaGmyBzUD0COxR1jEfDuOZJB8zf/vf9@dT@N4TelwOe7e0/y846XX9Lk99imFIEzKZJh6Jsc0MG2ZpMPAEehiMTBliLyhoA3pK6UNCVmyjhbtSgKELexabP4wxBWFCk19ibjme5@LMP1CmLwt@gySVtaV3G@1Sg34GoBv4Vv4drmjHhHjFw "Jelly – Try It Online")
### How it works
```
IsJEƇḢḢ  Main link. Argument: A (array)
I        Increment; compute D, the array of A's forward differences.
  J      Indices; yield [1, ..., len(A)].
 s       Split D into chunks of length k, for each k in [1, ..., len(A)].
   EƇ    Comb equal; keep only partitions of identical chunks.
     Ḣ   Head; extract the first matching parititon.
      Ḣ  Head; extract the first chunk.
```
[Answer]
# JavaScript (ES6), 58 bytes
Outputs a comma-separated string (with a leading comma).
```
a=>(a.map(p=x=>-(p-(p=x)))+'').match(/N((,\d+)*?)\1*$/)[1]
```
[Try it online!](https://tio.run/##ZZBNDoIwFIT3nqILE/r0Ib62IC7QG3gBZNHgf1SIGuPtcVQ0UReTNDPTr5Pu/NWfy9O2voTHarFsVlnjs4n2g4OvdZ3dskmo6/BxIqJ@EBCCS7nR0Uxrni/61JvSXHrdiHIpmrI6nqv9crCv1nqlc2HlWKWsxqxkCFloBMESeMZACQTPpAWRiiKVW3YsLEXnh4aiSAsBwABo4tdlC5DFUxZQJ29QzOYPgmLyPcZIy0lbDnKH3CF3ozfLYRSG/fHiJ@9Twx/cAQ "JavaScript (Node.js) – Try It Online")
Or **[56 bytes](https://tio.run/##ZZBNDoIwFIT3nqILE1p9iK8tiAv0Bl4AWTSAf1Fp1Bhvj6OiibqYNJmZfp10567uXJ62/hIem6puV1nrspl0o4Pz0me3bObDx6nUMAgU3Eu5kdFCSgqX1VAN5mrJg36kci7asjmem3092jdruZI5k7AkUhJTEjyGDDSBYDE8raEEgqfTQikRRSI3ZImJi94PDUXmDgKABlDHr8sGIIOnDKCW36CY9B8ExeR7jOaOk3Yc5Ba5RW4nb5bFKAz748VP3qeGP7gD)** if we use `,-` as the separator and we assume that the sequence is always *strictly* increasing.
### How?
We first convert the input array **a[ ]** to a list of consecutive differences with:
```
a.map(p = x => -(p - (p = x)))
```
Because **p** is initially set to a non-numeric value (the callback function of *map()*), the first iteration yields *NaN*.
Example:
```
[6, 11, 13, 18, 20, 25, 27, 32, 34, 39, 41]
[ NaN, 5, 2, 5, 2, 5, 2, 5, 2, 5, 2 ]
```
We then coerce the result to a string:
```
"NaN,5,2,5,2,5,2,5,2,5,2"
```
Finally, we look for the shortest1 pattern of comma-separated integers (`,\d+`) starting right after "NaN" and repeating till the end of the string:
```
match(/N((,\d+)*?)\1*$/)
```
*1: using the non-greedy `*?`*
[Answer]
# [Brachylog](https://github.com/JCumin/Brachylog), 11 bytes
```
s₂ᶠ-ᵐṅᵐ~j₍t
```
[Try it online!](https://tio.run/##SypKTM6ozMlPN/r/v/hRU9PDbQt0H26d8HBnK5Csy3rU1Fvy/3@0oY6CkY6CsY6CqY6CmY6CuY6CpY6CoQEQA2UMgeKGJkAMlDQ0j/0fBQA "Brachylog – Try It Online")
Would be 5 bytes if there was a built-in for consecutive differences.
### Explanation
```
Example input: [6, 11, 13, 18, 20, 25, 27, 32, 34, 39, 41] 
s₂ᶠ             Find all substrings of length 2: [[6,11],[11,13],…,[34,39],[39,41]]
   -ᵐ           Map subtraction: [-5,-2,-5,-2,-5,-2,-5,-2,-5,-2]
     ṅᵐ         Map negate: [5,2,5,2,5,2,5,2,5,2]
       ~j₍      Anti-juxtapose the list of differences; the shortest repeated list is found
                  first, with the biggest number of repetitions: [5,[5,2]]
            t   Tail: [5,2]
```
[Answer]
# Pyth, 11 bytes
```
<J.+Qf.<IJT
```
[Try it here](http://pyth.herokuapp.com/?code=%3CJ.%2BQf.%3CIJT&input=%5B1%2C+4%2C+8%2C+9%2C+10%2C+13%2C+17%2C+18%2C+19%2C+22%2C+26%2C+27%2C+28%5D&debug=0)
### Explanation
```
<J.+Qf.<IJT
 J.+Q          Call the sequence of differences in the input J.
     f         Find the first positive integer T...
      .<IJT    ... where rotating J by T doesn't change it.
<J             Take that many elements of J.
```
[Answer]
# [Japt](https://github.com/ETHproductions/japt), ~~14~~ 12 bytes
```
äa
¯@eUéX}aÄ
```
[Try it](https://ethproductions.github.io/japt/?v=1.4.5&code=5GEKr0BlVelYfWHE&input=WzUsNiw3XQ==)
---
## Explanation
```
              :Implicit input of array U
äa            :Consecutive absolute differences
\n            :Reassign to U
 @    }aÄ     :Return the first positive integer X that returns true
   UéX        :  Rotate U right X times
  e           :  Check equality with U
¯             :Slice U to that element
```
---
## Original
```
äa
@eUîX}a@¯XÄ
```
[Try it](https://ethproductions.github.io/japt/?v=1.4.5&code=5GEKQGVV7lh9YUCvWMQ=&input=WzUsNiw3XQ==)
[Answer]
# [R](https://www.r-project.org/), ~~49~~ 46 bytes
Full program:
```
d=diff(scan());while(any((s=d[1:T])-d))T=T+1;s
```
[Try it online!](https://tio.run/##BcExCoAwDAXQq/wxQQQTRavSW3QTBzEWC@JgB/H09b2nFPOWYqS8bzcxz@@ZroO2@yPK3haZwsq1MQcfKplzEXRwGCENpIUMEAcZoQrtoQPUlR8 "R – Try It Online")
### [R](https://www.r-project.org/), ~~72~~ ~~58~~ 54 bytes
Original function submission with all test cases in one place:
```
function(a,d=diff(a)){while(any((s=d[1:T])-d))T=T+1;s}
```
[Try it online!](https://tio.run/##XY/BCsIwEETvfkWOWVyhm6Y1Kv2L3sRDaQ0WpIJVRMRvrxNNsXqYy8ybYfc8@GLw166@tKdOV9wUTeu9roget0N73Ouqu2vdF81W1uWOFg1RWZRz2fTPwetaCyvDKmWVscpZLVmtWEkCIRH4YiGEsiSahYaZsC5yZsLCluBjxySxA8a@6XE8/QMxYDBp4BkXS/nkCBfGoOzDpOFmLKboWvkelv/OG4kVFyvILXKL3I7/xGeIhhc "R – Try It Online")
Thanks to JayCe for suggesting the full program route and -4 bytes on the function, and to Giuseppe for further -3.
[Answer]
# [J](http://jsoftware.com/), 22 19 bytes
3 bytes saved thanks to FrownyFrog! 
```
0{"1[:~./:|."{}.-}:
```
[Try it online!](https://tio.run/##Rc7BDoIwEIThO0/xhwsx0drdlhaa8CQejcR48cAR8dUrNEGuO19m9pXHaTBYEjbbuZZb@ppr@ph6XsxlSflU1YZmHEzDmSUxTlX1uD/fjCgtgUiHCKKIQzwSkfXSo3aHgl9Rj9hi/kDRgEa022UoVW4DatF2S53iPK7Hy7EcjjKVArsCA97iHT7utvyYfw "J – Try It Online")
[Try it online!][TIO-ji2uiwla]
## How?
```
                 -      find the successive differences by subtracting 
                  }:    the list with last element dropped
               }.       from the list with the first element dropped 
           |."{         rotate the list of differences
         /:             0..length-1 times (the input graded up)
     [:~.               remove duplicating rows
 0{"1                   take the first element of each row
```
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 8 bytes
Saved 3 bytes thanks to [Kevin Cruijssen](https://codegolf.stackexchange.com/users/52210/kevin-cruijssen).
```
¥.œʒË}нн
```
[Try it online!](https://tio.run/##yy9OTMpM/f//0FK9o5NPTTrcXXth74W9//9HG@komOkoGBoAsTEQm@soGBkCsSkQW@goGAOljYHyJkB5E6C8iXksAA "05AB1E – Try It Online")
---
### [05AB1E](https://github.com/Adriandmen/05AB1E), 11 bytes
```
āεI¥ô}ʒË}нн
```
[Try it online!](https://tio.run/##MzBNTDJM/f//SOO5rZ6Hlh7eUntq0uHu2gt7L@z9/z/aSEfBTEfB0ACIjYHYXEfByBCITYHYQkfBGChtDJQ3AcqbAOVNzGMB "05AB1E – Try It Online")
```
āεI¥ô}ʒË}нн   Full program.
ā             Length range. Push [1 ... len(inp)].
 ε   }        For each...
  I¥ô         ... Chop the deltas into pieces of the corresponding size
      ʒË}     Keep only those that have all their elements equal.
         нн   And first retrieve the first element of the first one.
```
---
### 13 bytes
A cute alternative, IMO:
```
¥©ηʒDg®ôÙ˜Q}н
```
[Try it online!](https://tio.run/##MzBNTDJM/f//0NJDK89tPzXJJf3QusNbDs88PSew9sLe//@jjXQUzHQUDA2A2BiIzXUUjAyB2BSILXQUjIHSxkB5E6C8CVDexDwWAA "05AB1E – Try It Online")
```
¥©ηʒDg®ôÙ˜Q}н   Full program.
¥               Push the deltas.
 ©              Copy them to the register.
  ηʒ       }    And filter the prefixes by...
    D     Q     ... Is the prefix itself equal to...
     g®ô        ... The deltas, split into chunks of its length...
        Ù˜      ... Deduplicated and flattened?
            н   Head.
```
[Answer]
# Javascript, 49 ~~56~~ bytes
*Edit* 7 bytes saved thanks (guess who?) Arnauld
Same regex idea as Arnauld, but curiously so different in implementation ...
Returning a string with steps comma separated (and a leading comma)
```
p=>/N(.+?)\1+$/.exec(p.map(p=v=>[v-p,p=v][0]))[1]
```
**Test**
```
var F=
p=>/N(.+?)\1+$/.exec(p.map(p=v=>[v-p,p=v][0]))[1]
;[[1, 2, 3, 5, 6, 7, 9, 10, 11, 13, 14, 15, 17]
,[1, 4, 8, 9, 10, 13, 17, 18, 19, 22, 26, 27, 28]
,[6, 11, 13, 18, 20, 25, 27, 32, 34, 39, 41] 
,[2, 6, 10, 13, 17, 21, 25, 28, 32, 36, 40, 43, 47]
,[5, 6, 7]]
.forEach(x=>console.log(x + ' -> ' + F(x)))
```
[Answer]
# [MATL](https://github.com/lmendo/MATL), ~~14~~ ~~13~~ 12 bytes
```
dt5YLFTF#Xu)
```
[Try it online!](https://tio.run/##XY6xDsIwDET3foUlJiQPteOkYUedGDuAokggMcJWvj9caJACg5e752c/b@ujXMt99ZfTvMy782tfjktJwqRMjskzBaaJ6cAkIwaNIBfDoJQpD0k7LjZGOw6x1BwOHcGjtw/5lbo/CMsKnSLTmGlIobscqwXjN8DVR6FzWDTZvgm/XpWGx4ajN/SG3qbqb@/nNw "MATL – Try It Online")
Just discovered that MATL does have a circulant function! 
### Explanation
`d` - Get the differences between successive terms, as an array
`t5YL` - duplicate that, then call the `YL` ('gallery') function with `5` ('circulant') option. Creates a matrix with the given vector as first row, then successive rows are the same vector shifted circularly, until it wraps around. 
`FTF#Xu` - Check for unique rows and get their row numbers (not sure if there's a shorter way of doing this). When sequence steps repeat, the circularly shifted row will be the same as the first row, and the subsequent rows will be repeats. So this gets the indices of the first run of sequence steps before they start repeating. 
`)` - index using that into the original differences array, to get the answer.
---
Older:
```
d`tt@YS-a}@:)
```
[Try it online!](https://tio.run/##XY4xDsIwDEX3nsIrkpFqJ00CUwduAAuKIrUSI2xZOXv6Q4MUGLz8//zs15qfZSmPJef5fj2u7/l8KJdbicKkTIZpYnJMnunEJCMGjSAXi0EpPg1ROy40RjsOsdQcDh3Bo7cf8is1fxCWFTpFpiHREF13OVQLZtoBUx@FzmDRyv6N@/WqNDw0HL1Fb9FbX/3t/bQB "MATL – Try It Online")
*(-1 byte thanks to Giuseppe)*
### Explanation:
```
d   % Get the differences between successive terms, as an array
`   % Start do-while loop
  tt  % duplicate the difference array twice
  @   % push the current loop index value
  YS  % circularly shift the difference array by that amount
  -   % subtract the shifted diffs from the original diffs
  a   % see if the subtraction resulted in any non-zeros
    % if it did, shifted differences were not equal to original differences, so continue loop 
}@ % if it didn't, then get loop index
:) % get the differences upto the loop index, before they started repeating
   % implicit loop end
```
[Answer]
# [Python 2](https://docs.python.org/2/), 101 bytes
```
def f(l):d=[y-x for x,y in zip(l,l[1:])];g=len(l);print[d[:k]for k in range(1,g+1)if g/k*d[:k]==d][0]
```
[Try it online!](https://tio.run/##HcrLDoIwEEDRX5llq2OkD8VA@iVNFyZ92NAUQliAP18HF3d17nJsn7nK1nyIEFnhgzf2uO0Q5xV2PCBX@OaFFSxWDI67MZkSKo3jsua6WW@HyZ3zdK7ru6bABKar4DlCuk@X/2CMd7ZzLTIrEZ4IoqMU1SNIQT2oF4IiVuSaXJPr3vH2Aw "Python 2 – Try It Online")
First generates the deltas **d**, then finds the first prefix **p** of **d** that when repeated **⌊len(L) / len(p)⌋** times yields **L**, where **L** is the input list.
[Answer]
# [Ruby](https://www.ruby-lang.org/), 62 bytes
Relies on Regex logic adapted from [Arnauld's answer](https://codegolf.stackexchange.com/a/166184/78274).
```
->a{i=-2;a.map{|x|(i+=1)>=0?x-a[i]:0}*?,=~/((,\d+)*?)\1*$/;$1}
```
[Try it online!](https://tio.run/##XY/JDoJAEETvfsUcOLA0SjcDombkQ3AOGEPCwYS4JBqXX8dCMRk99KWqXnX34by99o3p43V9a00sq3q6r7vb/XL328hwsDZJeYnrqrXL5BGWZJ4z36fNLgrCMthw6M1WHj/67nw6qqaqmJSQSkllpHJSc1ILUpxg4DB01hiYPLd28qXEyRdjVpw8ZB50dEnicMjpN/Fdkv6FUSKoFWhSOGDuHFQMpZjsk0uH@9Gagtf8e2T@u0Z4xIoRg6/ha/ja/W98ztr@BQ "Ruby – Try It Online")
Alternative determination of step differences, also 62 bytes:
```
->a{[0,*a.each_cons(2).map{|x,y|y-x}]*?,=~/((,\d+)*?)\1*$/;$1}
```
[Try it online!](https://tio.run/##XY/NDoJADITvPsUePABWoGUFjFEfBDcG/@JFJaKJBPXVcVBMVg@9zMw3bc/XVdXsps1wltdZSF7ub/P1frk@HUtHXP@QF/X9RtW9Gt4expvT9Bk4Di02A9ebuwv2@sGkz4@muF5KtcsyJiWkIlIjUjGphNSYFIcYOAydNQYmJ8b0vpRY@bTLipWHzK2OLgktDjn9Jr5Lor8wSgS1Ak1SC4ytg9K2FDP65KL2frRG4DX/Hhn/rhHusLTD4Gv4Gr62/@ueM6Z5AQ "Ruby – Try It Online")
[Answer]
# Java 10, ~~104~~ 100 bytes
```
a->{var t="";for(int i=a.length;i-->1;t+=a[i]-a[i-1]+" ");return t.replaceAll("( ?.+?)\\1*$","$1");}
```
Regex `( ?.+?)\1*$` for shortest repeating substring from [*@Neil*'s comment on *@Arnauld*'s JavaScript (ES6) answer](https://codegolf.stackexchange.com/questions/166177/get-the-sequence-steps/166184#comment402027_166184).
[Try it online.](https://tio.run/##lZBBbsIwEEX3nGJksUiKE2EnQKoooB6gbLoEFm4w1NQY5BiqCuXs6SS4Eu0KpEwkz7ff/zM7cRbRbv3ZlFpUFbwKZS49AGWctBtRSpi3R4A3Z5XZQhmgsliBCHNs11j4VU44VcIcDBTQiGh6OQsLriAk3xxs@wJUIWItzdZ95CqKpix3g0Is1CrCX8RWAwIkzK10J2vAxVYeNXq/aB2QAGbxYBYul@ypTyjpM7xYN/nV@Xh61@jsA5wPag17nCC4pu1y@vjflZP7@HBy8RElp01g4jIw8gu6gS6MAqeQUBhRGFOYUHimwIZYqDDssxQLRTapw274O6D8Bpd5FL/BYZu1fbTiw/uxiEk74G/E5B8LPTi6cuzx7H7u@GbarI2ENbpiknY5aJogPmUPbWD8NyRnnpp5Kuop6inq6QO79Yv1D@pe3fwA)
**Explanation:**
```
a->{                        // Method with integer-array parameter and String return-type
  var t="";                 //  Temp-String, starting empty
  for(int i=a.length;i-->1; //  Loop backward over the input-array, skipping the first item
    t+=a[i]-a[i-1]          //   Calculate the difference between two adjacent items
       +" ");               //   And append this with a space to the temp-String
  return t.replaceAll("( ?.+?)\\1*$", 
                            //  Find the shortest repeating substring
                     "$1");}//  And only keep one such substring
```
[Answer]
# APL+WIN, 39 bytes
Prompt for input.
```
(↑((⍴v)=+/¨(⊂v)=(⍳⍴v)⌽¨⊂v)/⍳⍴v)↑v←-2-/⎕
```
[Try it online! Courtesy of Dyalog Classic](https://tio.run/##SyzI0U2pTMzJT9dNzkksLs5M/v@ob6qvz6O2CcZcjzra0/5rPGqbqKHxqHdLmaattv6hFRqPupqATKDIZrDgo569h1aAxfThQm0Ty4AG6Brp6gMN@w805n8al6GCkYKxgqmCmYK5gqWCoYGCoaGCobGCoYmCoamCoTlXGpcRVNYCLGUEkzVXMASKWCoYGQAA "APL (Dyalog Classic) – Try It Online")
Explanation:
```
v←-2-/⎕ Prompt for input and take successive differences
(⍳⍴v)⌽¨⊂v create a nested vector ans sequentially rotate by one to length of v
+/¨(⊂v)= compare to original v and sum positions where there is match
(⍴v)= identify where all elements match
(↑(....) identify number of rotations giving a first complete match
(↑(...)↑v take first number of elements from above from v as repeated sequence
```
[Answer]
# [Python 2](https://docs.python.org/2/), ~~86~~ 85 bytes
```
def f(a,n=1):d=[y-x for x,y in zip(a,a[1:])];return d[:-n]==d[n:]and d[:n]or f(a,n+1)
```
[Try it online!](https://tio.run/##XZDBasMwEETP6VfsLTXZQFZWHEdF/RGhg0Ax9UUxxoE4P@@OXBXcHvYy82a0q2Gevu5JLUu8ddS9B05WKhOtm49P6u4jPXmmPtGrH2AGJ8ZX/mO8TY8xUXTmmLy10SXjQ4pZSB6htegg1ZIbQs47J0yKqWY6MzVMF6Yrk5wwcAS6aAxMuXgmpzZgWyC1ASFL1lGiTjkAQK/ob239j0JaoU9BU21ONJu321yDOf8AdV4VdTWCWso@zd9iJYVvCw9fw9fw9XpDOcB787Ybxj5NFHhvP/eM/6mWbw "Python 2 – Try It Online")
Construct the differences as `d`; if `d` repeats with unit size `n` then `d[n:]==d[:-n]`; else recurse.
[Answer]
# [Retina 0.8.2](https://github.com/m-ender/retina/wiki/The-Language/a950ad7d925ec9316e3e2fb2cf5d49fd15d23e3d), 42 bytes
```
\d+
$*
(?<=(1+),)\1
1+(.+?)\1*$
$1
1+
$.&
```
[Try it online!](https://tio.run/##PU45DsIwEOz3HQY58SjKrDe2I4FS8okUIEFBQ4H4vzER0M2ted5e98el7vzpXNdrENeLXw5Hz9ChWynC4IewNNg7cWxU3LCvlVBETEjImMERJBhBAycwC2EoX6fJGSzgDFVogmZokfTrFOgInT5ybKuGOMMo2sb/deWWKFsiwUZYhGXZHrwB "Retina 0.8.2 – Try It Online") Link includes test cases. Output includes leading comma. Explanation:
```
\d+
$*
```
Convert to unary.
```
(?<=(1+),)\1
```
Compute forward differences, except for the first number, which gets left behind.
```
1+(.+?)\1*$
$1
```
Match repeating differences.
```
1+
$.&
```
Convert to decimal.
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E/wiki/Commands), ~~14~~ 13 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage)
```
¥DηvÐNƒÁ}QD—#
```
[Try it online](https://tio.run/##AUQAu/8wNWFiMWX//8KlRM63dsOQTsaSw4F9UUTigJQj//9bMiw2LDEwLDEzLDE3LDIxLDI1LDI4LDMyLDM2LDQwLDQzLDQ3XQ) or [verify all test cases](https://tio.run/##TY49CsJAFISvIthOsfP27U/61IL1kkLBK9gJegMRr@ARxN6AZQ7hRdbNxqDt@76ZN8Ztttzl4Z6ft3Z47Pvz6nXpT4d1@z5elzmnRAgsHDwCGtCABC2ooANDh0WSL46VyYwDWC4NxIwSoUWYGuwfFIiHBEgcLT/XxxKDuJHYMkBhGyinb/5XIqxSrJKHGqiF1lV1U9d9AA).
I know there are already [two shorter 05AB1E answers posted by *@Mr.Xcoder*](https://codegolf.stackexchange.com/a/166188/52210), but I wanted to try this alternative approach using rotation and equality check.  
Might be able to golf it down a few bytes without dropping `Á`.
-1 byte after a tip of *@Emigna* to remove the global\_variable registers (`©` and 2x `®`) and use a Duplicate (`D`) and a Triplicate (`Ð`) instead.
**Explanation:**
```
¥             # Calculate the deltas of the input-array
              #  i.e. [1,2,3,5,6,7,9] → [1,1,2,1,1,2]
 D            # Duplicate it
  η           # Push all its prefixes
              #  [1,1,2,1,1,2] → [[1],[1,1],[1,1,2],[1,1,2,1],[1,1,2,1,1],[1,1,2,1,1,2]]
v             # For-each over these prefixes
 Ð            #  Triplicate the (duplicated) deltas-list
  NƒÁ}        #  Rotate the deltas-list N+1 amount of times,
              #  where N is the prefix index (== prefix_length-1)
              #   i.e. [1,1,2] and [1,1,2,1,1,2] (rotate 3 times) → [1,1,2,1,1,2]
      Q       #  If the rotated deltas and initial deltas are equal
              #   [1,1,2,1,1,2] and [1,1,2,1,1,2] → 1
       D—#    #  Print the current prefix-list, and stop the for-each loop
```
[Answer]
Haskell, 107 bytes
```
let i=map(uncurry(-))$zip(tail x)(init x)in head$filter(\s->take(length i)(concat$repeat s)==i)(tail$inits i)
```
x is the input array.
[Answer]
# [Stax](https://github.com/tomtheisen/stax), ~~8~~ 6 [bytes](https://github.com/tomtheisen/stax/blob/master/docs/packed.md#packed-stax)
```
░»F\☺»
```
[Run and debug it](https://staxlang.xyz/#p=b0af465c01af&i=[2,+5,+6,+7,+8,+11,+12,+13,+14,+17,+18,+19,+20]%0A[1,+4,+8,+9,+10,+13,+17,+18,+19,+22,+26,+27,+28]%0A[2,+6,+10,+13,+17,+21,+25,+28,+32,+36,+40,+43,+47]%0A[5+6+7]&a=1&m=2)
Here's an unpacked annotated version to show how it works.
```
:-  pairwise differences
:(  all leftward rotations of array
u   keep only unique rotations
mh  output the first element from each unique rotation
```
[Run this one](https://staxlang.xyz/#c=%3A-%09pairwise+differences%0A%3A%28%09all+leftward+rotations+of+array%0Au%09keep+only+unique+rotations%0Amh%09output+the+first+element+from+each+unique+rotation&i=[2,+5,+6,+7,+8,+11,+12,+13,+14,+17,+18,+19,+20]%0A[1,+4,+8,+9,+10,+13,+17,+18,+19,+22,+26,+27,+28]%0A[2,+6,+10,+13,+17,+21,+25,+28,+32,+36,+40,+43,+47]%0A[5+6+7]&a=1&m=2)
[Answer]
# [Perl 6](https://perl6.org), 57 bytes
```
{~(.rotor(2=>-1).map:{.[1]-.[0]})~~/^(.+?){}" $0"+$/;~$0}
```
[Test it](https://tio.run/##fZBdbsIwDMffcwpr6gZdQ2nSUti6dj3AHvdWwoQgk5D4qGiZNqH2MNvjzsDLLsQRmBPSifGAFMeR7d/fsXO5noeHTSHhLXQnESGLD7iZrKYS4sO2brvrVblat3mcdJjtLsb5/dbNmOi4mScqu667o7brPNrb6gos78qxulFtedUBRdJSFiXEMJ8tZaFJ2BKALhrASN/D4lb7/e4z2@@@oFYvoV5Z@jBb5psyQYFsOHWEcOAashZtISMaGFpx0rqsIt9zOSnl9LKQ9pb6XYSX8/PdtHefZkVJj5E/KRO0XkhFiNrcM04akXw@XoKjx47I62ptNtBJoJ1qNZo2EghPZTGx9UZmBah9myKbwnlZRKpDxihwCj6FHoWQQp/CHQXmoWGGYZwFaJhkfQFxAgpQjCAZP4EGBuAnEIaZiqMg946wr2F1kEcXaLLp6J9BKMZRnmOMDxqBgDKq6PDkiwPVAa13LPbVRCjto0jAjmCPmi@H/5txZriB4TAfYD7AfGBGDrApNkbezGs2IX4B "Perl 6 – Try It Online")
Output is space separated (`"1 1 2"`)
## Expanded:
```
{      # bare block lambda with implicit parameter $_
  ~(   # stringify (space separated)
    .rotor( 2 => -1 )     # from the input take 2 backup 1, repeat
    .map: { .[1] - .[0] } # subtract each pair to find the differences
  )
  ~~   # smartmatch
  /    # regex
    ^  # beginning of string
    ( .+? ) # match at least one character, but as few as possible
    {}      # make sure $0 is set (probably a compiler bug)
    " $0"+  # match $0 one or more times (with a leading space)
    $  # end of string
  /;
  ~$0  # return the stringified $0
}
```
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 9 bytes
```
¥©η.ΔÞ®Å?
```
Explanation:
```
          # take input implicitly
¥         # deltas, eg [4, 5, 7, 8, 10] -> [1, 2, 1, 2]
 ©        # save this to the global register
  η       # prefixes, eg [1, 2, 1, 2] -> [[1], [1, 2], ...]
   .Δ     # find the first one such that
     Þ    # cycled infinitely, eg [1, 2] -> [1, 2, 1, 2, ...]
       Å? # starts with
      ®   # the global register
          # and implicitly print the found element
```
Alternative 9-byte:
```
¥η.ΔÞ.¥-Ë
```
Same algo, but instead of comparing to the list of deltas (which needs to be saved/restored), this uses `.¥` (undelta) then compares to the (implicit) input.
[Try it online!](https://tio.run/##yy9OTMpM/f//0NJDK89t1zs35fC8Q@sOt9r//x9tqKNgpKNgrKNgqqNgpqNgrqNgqaNgaADEQBlDoLihCRADJQ3NYwE "05AB1E – Try It Online")
[Answer]
# [Perl 5](https://www.perl.org/) `-p`, 55 bytes
```
s/\d+ (?=(\d+))/($1-$&).$"/ge;s/\d+$//;s/^(.+?)\1*$/$1/
```
[Try it online!](https://tio.run/##HclBCoNAEETRqxTSyIyibakTEREvIllFghDiEHN@W3H1H/y4/D7BbNf5lcNNo7vqvTphIakvJdH3MtxXVC88XZlPfmYmKlQzokaDgAc69GAFEmzAFgxgd2zxv27f3Yp4Ag "Perl 5 – Try It Online")
Numbers are input as a space separated list. Output is the same format.
[Answer]
# [Husk](https://github.com/barbuz/Husk), 12 bytes
```
←ḟΛ=Um`CẊ≠⁰N
```
[Try it online!](https://tio.run/##AUEAvv9odXNr///ihpDhuJ/Omz1VbWBD4bqK4omg4oGwTv///1s2LDExLDEzLDE4LDIwLDI1LDI3LDMyLDM0LDM5LDQxXQ "Husk – Try It Online") or [Verify all test cases](https://tio.run/##RcwhDgIxFADRC43o/@22XYHC41BNEyQJWUU4wCJIQOERcAQk4RDcYXuRstSg52W2h/2uDuU41nK6Tq/757ZYD5vl9L6U86OMz1WtNSXBEekRg1gkIBHpUUU9GtCYSR6RliNq0O4XrGIdtsfJLBT/X6g0E5vxOIOzuDCzbmYh5y8 "Husk – Try It Online")
[Answer]
# [Wolfram Language (Mathematica)](https://www.wolfram.com/wolframscript/), ~~26~~ 23 bytes
```
FindRepeat@*Differences
```
[Try it online!](https://tio.run/##TY47DsIwEER7n8I1Wons2vlQIKVA1IgbWMEWLohQSBfl7GacuEgxzds3o/24@e0/bo6DS@Ga7nF8Pf3Xu7k/3WIIfvLj4H/pMcURKJx7tahFSNekG9It6Y40MwLGBrEIMGd@IS3VSmqBYDcVhKtiHi20BXsCJl1uNGXW7JKgJPUuGMgGcwZFy1mW7ZnjsHDxu@LjbnG3uNs2d2pqqF3Vmv4 "Wolfram Language (Mathematica) – Try It Online")
[Answer]
# [K4](http://kx.com/download), 30 bytes
**Solution:**
```
(*&d~/:c#'(!c:#d)#\:d)#d:1_-':
```
**Examples:**
```
q)k)(*&d~/:c#'(!c:#d)#\:d)#d:1_-':2, 5, 6, 7, 8, 11, 12, 13, 14, 17, 18, 19, 20
3 1 1 1
q)k)(*&d~/:c#'(!c:#d)#\:d)#d:1_-':1, 2, 3, 5, 6, 7, 9, 10, 11, 13, 14, 15, 17
1 1 2
q)k)(*&d~/:c#'(!c:#d)#\:d)#d:1_-':1, 4, 8, 9, 10, 13, 17, 18, 19, 22, 26, 27, 28
3 4 1 1
q)k)(*&d~/:c#'(!c:#d)#\:d)#d:1_-':6, 11, 13, 18, 20, 25, 27, 32, 34, 39, 41
5 2
q)k)(*&d~/:c#'(!c:#d)#\:d)#d:1_-':2, 6, 10, 13, 17, 21, 25, 28, 32, 36, 40, 43, 47
4 4 3 4
q)k)(*&d~/:c#'(!c:#d)#\:d)#d:1_-':5 6 7
,1
```
**Explanation:**
Seems hefty for what we're trying to solve. Get the deltas of the input and then build sequences and determine the shortest one that matches it.
```
(*&d~/:c#'(!c:#d)#\:d)#d:1_-': / the solution
                           -': / deltas 
                         1_    / drop first
                       d:      / save as d
                      #        / take (#) from
(                    )         / do this together
                 #\:d          / take (#) each-left (\:) from d
          (     )              / do this together
              #d               / count length of d
            c:                 / save as c
           !                   / range 0..c-1
       c#'                     / take c copies of each
   d~/:                        / d equal (~) to each right (/:)
  &                            / where true
 *                             / first one
```
]