[Question]
  [
## Non-math explanation
*This is an explanation that is meant to be approachable regardless of your background. It does unfortunately involve some math, but should be understandable to most people with a middle school level of understanding*
A pointer sequence is any sequence such that \$a(n+1) = a(n-a(n))\$.
Lets pick apart this formula a little bit to understand what it means. This just means to figure out the next term in the sequence we look at the last term, take that many steps back and copy the term we find. For example if we had the sequence so far to be
```
... 3 4 4 4 3 ?
```
We would take 3 steps back from `3`
```
... 3 4 4 4 3 ?
      ^
```
making our result `4`.
Now normally we play this game on a tape that is infinite in both directions, but we can also play it on a wheel where after a certain number of steps we get back to the beginning of the sequence.
For example here is an visualization of the sequence `[1,3,1,3,1,3]`
[![Wheel](https://i.stack.imgur.com/0Rhpk.png)](https://i.stack.imgur.com/0Rhpk.png)
Now we might notice that any number, \$x\$ in a wheel that exceeds the number of cells in the wheel, \$n\$, might as well be \$x\$ modulo \$n\$ because every complete circuit around the wheel is the same as doing nothing. So we will only consider wheels with all members being less than the size of the wheel.
## Math explanation
A pointer sequence is any sequence such that \$a(n+1) = a(n-a(n))\$. Usually these are defined from the integers to the integers, however you might notice that the only things needed in this definition are a successor function and an inverse function. Since all cyclic groups have both of these we can actually consider pointer sequences on any cyclic groups.
If we start looking for these types of functions we will notice that for each function there are a couple of similar functions. For example on \$\mathbb{Z}\_3\$ the following 3 are all functions that fit our requirements.
```
f1 : [1,2,2]
f2 : [2,1,2]
f3 : [2,2,1]
```
*(Here a list is used to represent a function to get the result just index the list by the input)*
We might notice that these functions are all "rotations" of each other. To formalize what I mean by rotation, a function \$b\$ is a rotation of \$a\$ iff
\$
\exists n : \forall m : a(m+n) = b(m)
\$
We can actually show that if \$a\$ is a pointer sequence every rotation of \$a\$ is also a pointer sequence. Thus we will actually consider any sequences that are rotations of each other to be equivalent.
## Task
Given \$n\$ as input output the number of pointer sequences that have size \$n\$.
This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'") so answers will be scored in bytes with less bytes being better.
## Testcases
Currently these testcases are lacking a bit, I have a computer program to generate these but it is inordinately slow at doing so. If anyone would like to contribute larger testcases (that they can verify correct) they are free to do so. Below some tests is a list of all the functions that I found, this might be useful for debugging. I can't add these for the larger ones because of character limits.
If you want the code I used to generate these [here it is](https://tio.run/##ZVI9b8IwEN39Kw6JwVYVRMYi0q1Dt24dIgMmcRsLx7YSQ6Hiv6dn7KSILjnfu4/37i6N6A9S62E4yU59XkCr3oMhcIUW1pmW5ss3ESyimc2AtrYGap5yBi2D4l8gG30TEghR/btVxstubCS0pnd8rFwuFndUWc4JqeVe9BIMBBP0mKJYYm3Jg2N9I7tvhQkFBNKYtkpFtFanBLFYT1xU0CNcQC3ro4OyXF7P66zMFwvDOYc5fCodVP7pnSBqrH/VsoUlm7fCAd1Fqh2OWJoNzpwzbLMxSXvoXzWyOsgaFSNlch5C1Fu3OprksjCZMBegnfXCi72WgAlsSh@Vj/5U@biSmHbrPva@Sya39hJWK3gzHrIXKAVPZoxto@xyAgycewR@lPtQeKfKGjwlrTvrMESrS4Vizz1j@EkEN/0C9lglw@r2uM6xPE6I1wnb50h83cZLpN9AcD60Qt2OZQlo6cHhe7riMwHX4Rtbpgo3Im74BQ "Haskell – Try It Online")
```
1 -> 1
[[0]]
2 -> 2
[[1,1],[0,0]]
3 -> 4
[[2,2,2],[2,2,1],[1,1,1],[0,0,0]]
4 -> 7
[[3,3,3,3],[3,3,3,2],[2,2,2,2],[3,3,3,1],[3,1,3,1],[1,1,1,1],[0,0,0,0]]
5 -> 12
[[4,4,4,4,4],[4,4,4,4,3],[3,3,3,3,3],[4,4,4,4,2],[4,3,4,4,2],[2,2,2,2,2],[4,4,4,4,1],[4,3,4,4,1],[4,4,2,4,1],[4,4,1,4,1],[1,1,1,1,1],[0,0,0,0,0]]
6 -> 35
[[5,5,5,5,5,5],[5,5,5,5,5,4],[5,5,4,5,5,4],[4,4,4,4,4,4],[5,5,5,5,5,3],[5,4,5,5,5,3],[5,5,5,3,5,3],[5,3,5,3,5,3],[3,3,3,3,3,3],[5,5,5,5,5,2],[5,4,5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1],[7,5,7,7,7,2,7,1],[7,3,7,7,7,2,7,1],[7,7,6,7,7,2,7,1],[7,7,4,7,7,2,7,1],[7,7,2,7,7,2,7,1],[7,4,2,7,7,2,7,1],[7,7,1,7,7,2,7,1],[7,7,2,7,2,2,7,1],[7,5,2,7,2,2,7,1],[7,4,2,7,2,2,7,1],[7,7,7,7,7,1,7,1],[7,6,7,7,7,1,7,1],[7,5,7,7,7,1,7,1],[7,3,7,7,7,1,7,1],[7,7,6,7,7,1,7,1],[7,7,4,7,7,1,7,1],[7,7,2,7,7,1,7,1],[7,7,1,7,7,1,7,1],[7,7,7,5,7,1,7,1],[7,5,7,5,7,1,7,1],[7,3,7,5,7,1,7,1],[7,7,7,3,7,1,7,1],[7,5,7,3,7,1,7,1],[7,3,7,3,7,1,7,1],[7,7,7,2,7,1,7,1],[7,7,7,1,7,1,7,1],[7,5,7,1,7,1,7,1],[7,3,7,1,7,1,7,1],[7,1,7,1,7,1,7,1],[5,1,5,1,5,1,5,1],[4,7,1,7,7,7,4,1],[4,7,1,7,7,5,4,1],[3,7,7,1,7,7,3,1],[3,7,3,1,3,7,3,1],[3,5,7,1,7,5,3,1],[3,5,3,1,3,5,3,1],[3,3,3,1,3,3,3,1],[3,1,3,1,3,1,3,1],[1,1,1,1,1,1,1,1],[0,0,0,0,0,0,0,0]]
9 -> 1049
10 -> 4304
```
*Last case calculated by @HyperNeutrino*
  
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), ~~18~~ 17 bytes
```
J_ịṙ1⁼
ṗṙ€RṂ€QÇ€S
```
[Try it online!](https://tio.run/##y0rNyan8///hzpl1QKx7dJJLJtfDndOB7EdNa4Ie7mwCUoGH24Fk8H@zoENbj@4Bc9z/AwA "Jelly – Try It Online")
### How it works
```
ṗṙ€RṂ€QÇ€S  Main link. Argument: n
ṗ           Cartesian power; yield all vectors of n elements of [1, ..., n].
   R        Range; yield [1, ..., n].
 ṙ€         Rotate each vector 1, ..., and n units to the left.
    Ṃ€      Take the minimum of each array of rotations of the same vector.
      Q     Unique; deduplicate the resulting array.
            Since each vector is replaced by its lexicographically minimal
            rotation, no resulting vector will be a rotation of another vector.
       Ç€   Map the helper link over the remaining vectors.
            Vectors that represent pointer sequences map to 1, others to 0.
         S  Take the sum.
J_ịṙ1⁼      Helper link. Argument: v = (v1, ..., vn)
J           Indices; yield [1, ..., n].
 _          Subtract v, yielding [1 - v1, ..., n - vn].
  ị         Index into v, yielding [v(1 - v1), ..., v(n - vn)].
   ṙ1       Rotate the result one unit to the left.
     ⁼      Compare the result with v.
```
[Answer]
# [Python 2](https://docs.python.org/2/), ~~162~~ ~~156~~ ~~152~~ ~~146~~ 143 bytes
```
lambda n:len({min(l[i:]+l[:i]for i in R(n))for l in product(*[R(n)]*n)if all(l[-~i-n]==l[i-l[i]]for i in R(n))})
from itertools import*
R=range
```
[Try it online!](https://tio.run/##XYyxDgIhEET7@4ot4QyNjQkJP3HtSYEe6CbLQhAvMcb7dTwsLaZ4kzeTX/We@NiCOTdy8bI4YE2exTsiC5pR2wPNGm1IBRCQYRIsZSfqlEtantcqxrn3dmSJARzRPlUbKrbG7Cdqj/27@MghlBQBqy81JXoAxpxKHYfJFMc337q/dv@H4iR1LsgVglDbKtsX "Python 2 – Try It Online")
More or less brute force:
* Generates all permutations `product(r,repeat=n)`
* Checks valid lists. `all(l[-~i-n]==l[i-l[i]]for i in r)`
* Generates a set of the minimum (lexicographical) rotation of the valid lits `min(l[i:]+l[:i]for i in r)`
---
**Recursive function that short circuits a bit:**
This version is longer, but is able to calculate `f(10)` in ~19 secs on [tio.run](https://tio.run/##VY0xDoMwDEV3TpHRhlABY1R6EZohVRPqiBoU6IAQvTpNhkrt4C8P//03rctj5OZw7fUYzPN2N4LVYBl6YAllLTFnxCy0wXBvs779lqSRvq3UbBdAcsLwCgnbImK68k0l6/hQGU/rHS@NG4MgQSwCeEQ7zFZE@PRiGhnyLvlMp7wugCQWpvNFrbSMiT8ko042f2aRFrYnMUSD0hFQpP@auB9TIF6Eg7rC4wM)
On my machine, I've found:
* `f(11) = 16920`
* `f(12) = 78687`
# [Python 2](https://docs.python.org/2/), 209 bytes
```
lambda n:len(g(n,(-1,)*n))
r=range
g=lambda n,a,j=0:set()if any(len({-1,a[-~i-n],a[i-a[i]]})>2for i in r(j))else set.union(*[g(n,a[:j]+(i,)+a[j+1:],j+1)for i in r(n)])if j<n else{min(a[i:]+a[:i]for i in r(n))}
```
[Try it online!](https://tio.run/##VY4xDsIwDEV3TpENmzqIMEaUi5QMQaTFUXGrUAaE4OolGRAw2LKl//w83qfzINu5rQ9z7y/Hk1di@yDQgRBoQ7gSxEWqk5cuLLr6EyJPsd7Ya5gAuVVe7lCwR0Z8o1@sxeWBdS7nnrjftkNSrFhUgogY@mtQGV7fhAeBVVN8vrHRVcCElW9iZayj3PGHFHTFFneiyoXHhQWywboMWHZ/SXzO3718D4aMQTsmlkkxLfV@SS0wzm8 "Python 2 – Try It Online")
**Explanation:**
```
f=lambda n:len(g(n,(-1,)*n)) #calls the recursive function, and gets length.
#The initial circle is all -1, and is built recursively
r=range
g=lambda n,a,j=0:
#if any of the indexes so far break the pointer rule (ignored if 'empty'), stop recursion.
if any(len({-1,a[-~i-n],a[i-a[i]]})>2for i in r(j))
    return set()
else
if j<n:
    #recursively call g with a+ all numbers in range ie.(a+[0], a+[1], ..)
    return set.union(*[g(n,a[:j]+(i,)+a[j+1:],j+1)for i in r(n)])
else # if recursion depth == n, we are done. Return the smallest (lexicographically) rotation.
    return {min(a[i:]+a[:i]for i in r(n))}
```
[Answer]
# CJam, 37
```
ri:M_m*{:XM,Xfm<:e<=M{(_X=-X=}%X=&},,
```
[Try it online](http://cjam.aditsu.net/#code=ri%3AM_m*%7B%3AXM%2CXfm%3C%3Ae%3C%3DM%7B(_X%3D-X%3D%7D%25X%3D%26%7D%2C%2C&input=5)
Pretty much brute force, and it feels kinda clumsy. It gets very slow after 6. Replace the last comma with a `p` to print the wheels.
[Answer]
# Pyth, 28 bytes
```
l{mS.>LdQf!fn@ThY@T-Y@TYUQ^U
```
[Test suite](https://pyth.herokuapp.com/?code=l%7BmS.%3ELdQf%21fn%40ThY%40T-Y%40TYUQ%5EU&test_suite=1&test_suite_input=3%0A4%0A5%0A6&debug=0)
First, we generate all sequences of the appropriate length with the appropriate elements. Second, we check whether there are any pointer failures. Third, map to all sorted rotations. Fourth, deduplicate and count.
[Answer]
# [Haskell](https://www.haskell.org/), ~~117 112~~ 104 bytes
```
f k|x<-[1..k]=sum[1|y@(h:t)<-mapM(x<$f)x,t++[h]==[y!!mod(n-a)k|(n,a)<-zip x y],and[y<=drop n y++y|n<-x]]
```
Brute force, so pretty slow for large inputs.
[Try it online!](https://tio.run/##Fc1BCsMgEEDRq0ygC8UYyK4UhV4gJxApghXFOJEkBS3e3Tb7z/veHPG9rr07iK0IruZpiloen6TmVp/EP04qeDJ5IUXcHC3jyZjyWkpVhyFtliA3NDaCo/mH35ChQNWjQauqkHbfMiBUxmpDwYvWPZmAIOEiX0DyHvCECRyFa33X/Qc "Haskell – Try It Online")
-5 bytes thanks to Laikoni.
-5 bytes thanks to Ørjan Johansen.
[Answer]
# [Wolfram Language (Mathematica)](https://www.wolfram.com/wolframscript/), ~~150~~ 123 bytes
```
nCount[Tuples[r=Range@n-1,{n}],l_/;l==Sort[l~RotateLeft~#&~Array~n][[1]]&&And@@(!1!-!0//.!a_:>l[[Mod[#+a,n,1]]]&/@r)]
```
[Try it online!](https://tio.run/##Jc1NCoJAFADgswzC0M@YuWlRTIy0TQhr9xjikWMJ41OmcRGRh/AGdUGPYEH7D74K/c1U6MsLjoUcaejfu7olD6e2seYOTmZIV6MojMWTXlrYc7SxUh5r58F2We3Rm70pfBfwLnEOHx1pgFhrzhPKlZqweOg/LGTLKFowPK@3FiCtcwjmKEj8oOaRclM9ptjAwZXk1awQ/3Wlxy8 "Wolfram Language (Mathematica) – Try It Online")
-27 bytes thanks to att.
Explanation from 150 byte version:
```
p=Part[#,Mod[#2,Length@#,1]]&;            -helper function to take part of circular list
n|->
  Count[                                  -count all the
    Tuples[Range@n-1,{n}],                  -possible sequences
    _?(l|->                                 -where
      l==Sort[Array[RotateLeft[l,#]&,n]][[1]]  -the sequence is the first of all rotations of that sequence
      &&                                       -and
      And@@Array[p[l,#+1]==p[l,#-p[l,#]]&,n]   -the pointer property holds for all elements in that sequence
  )]
```
]