Finding approximate correlations Consider a binary string S of length n.  Indexing from 1, we can compute the Hamming distances between S[1..i+1] and S[n-i..n] for all i in order from 0 to n-1.    The Hamming distance between two strings of equal length is the number of positions at which the corresponding symbols are different. For example,
S = 01010

gives
[0, 2, 0, 4, 0].

This is because 0 matches 0, 01 has Hamming distance two to 10, 010 matches 010, 0101 has Hamming distance four to 1010  and finally 01010 matches itself.
We are only interested in outputs where the Hamming distance is at most 1, however. So in this task we will report a Y if  the Hamming distance is at most one and an N otherwise.  So in our example above we would get
[Y, N, Y, N, Y]

Define f(n) to be the number of distinct arrays of Ys and Ns one gets when iterating over all 2^n different possible bit strings S of length n.
Task
For increasing n starting at 1, your code should output f(n).
Example answers
For n = 1..24, the correct answers are:
1, 1, 2, 4, 6, 8, 14, 18, 27, 36, 52, 65, 93, 113, 150, 188, 241, 279, 377, 427, 540, 632, 768, 870

Scoring
Your code should iterate up from n = 1 giving the answer for each n in turn. I will time the entire run, killing it after two  minutes.
Your score is the highest n you get to in that time.
In the case of a tie, the first answer wins.
Where will my code be tested?
I will run your code on my (slightly old) Windows 7 laptop under cygwin.  As a result, please give any assistance you can to help make this easy.
My laptop has 8GB of RAM and an Intel i7 5600U@2.6 GHz (Broadwell) CPU with 2 cores and 4 threads. The instruction set includes SSE4.2, AVX, AVX2, FMA3 and TSX.
Leading entries per language

n = 40 in Rust using CryptoMiniSat, by Anders Kaseorg. (In Lubuntu guest VM under Vbox.)
n = 35 in C++ using the BuDDy library, by Christian Seviers. (In Lubuntu guest VM under Vbox.)
n = 34 in Clingo by Anders Kaseorg. (In Lubuntu guest VM under Vbox.)
n = 31 in Rust by Anders Kaseorg.
n = 29 in Clojure by  NikoNyrh.
n = 29 in C by bartavelle.
n = 27 in Haskell by  bartavelle
n = 24 in Pari/gp by  alephalpha.
n = 22 in Python 2 + pypy by me.
n = 21 in Mathematica by  alephalpha. (Self reported)


Future bounties
I will now give a bounty of 200 points for any answer that gets up to n = 80 on my machine in two minutes.
Rust, n ≈ 30 or 31 or 32

On my laptop (two cores, i5-6200U), this gets through n = 1, …, 31 in 53 seconds, using about 2.5 GiB of memory, or through n = 1, …, 32 in 105 seconds, using about 5 GiB of memory.  Compile with cargo build --release and run target/release/correlations.

src/main.rs

extern crate rayon;

type S = u32;
const S_BITS: u32 = 32;

fn cat(mut a: Vec&lt;S&gt;, mut b: Vec&lt;S&gt;) -&gt; Vec&lt;S&gt; {
    if a.capacity() &gt;= b.capacity() {
        a.append(&amp;mut b);
        a
    } else {
        b.append(&amp;mut a);
        b
    }
}

fn search(n: u32, i: u32, ss: Vec&lt;S&gt;) -&gt; u32 {
    if ss.is_empty() {
        0
    } else if 2 * i + 1 &gt; n {
        search_end(n, i, ss)
    } else if 2 * i + 1 == n {
        search2(n, i, ss.into_iter().flat_map(|s| vec![s, s | 1 &lt;&lt; i]))
    } else {
        search2(n,
                i,
                ss.into_iter()
                    .flat_map(|s| {
                                  vec![s,
                                       s | 1 &lt;&lt; i,
                                       s | 1 &lt;&lt; n - i - 1,
                                       s | 1 &lt;&lt; i | 1 &lt;&lt; n - i - 1]
                              }))
    }
}

fn search2&lt;SS: Iterator&lt;Item = S&gt;&gt;(n: u32, i: u32, ss: SS) -&gt; u32 {
    let (shift, mask) = (n - i - 1, !(!(0 as S) &lt;&lt; i + 1));
    let close = |s: S| {
        let x = (s ^ s &gt;&gt; shift) &amp; mask;
        x &amp; x.wrapping_sub(1) == 0
    };
    let (ssy, ssn) = ss.partition(|&amp;s| close(s));
    let (cy, cn) = rayon::join(|| search(n, i + 1, ssy), || search(n, i + 1, ssn));
    cy + cn
}

fn search_end(n: u32, i: u32, ss: Vec&lt;S&gt;) -&gt; u32 {
    if i &gt;= n - 1 { 1 } else { search_end2(n, i, ss) }
}

fn search_end2(n: u32, i: u32, mut ss: Vec&lt;S&gt;) -&gt; u32 {
    let (shift, mask) = (n - i - 1, !(!(0 as S) &lt;&lt; i + 1));
    let close = |s: S| {
        let x = (s ^ s &gt;&gt; shift) &amp; mask;
        x &amp; x.wrapping_sub(1) == 0
    };
    match ss.iter().position(|&amp;s| close(s)) {
        Some(0) =&gt; {
            match ss.iter().position(|&amp;s| !close(s)) {
                Some(p) =&gt; {
                    let (ssy, ssn) = ss.drain(p..).partition(|&amp;s| close(s));
                    let (cy, cn) = rayon::join(|| search_end(n, i + 1, cat(ss, ssy)),
                                               || search_end(n, i + 1, ssn));
                    cy + cn
                }
                None =&gt; search_end(n, i + 1, ss),
            }
        }
        Some(p) =&gt; {
            let (ssy, ssn) = ss.drain(p..).partition(|&amp;s| close(s));
            let (cy, cn) = rayon::join(|| search_end(n, i + 1, ssy),
                                       || search_end(n, i + 1, cat(ss, ssn)));
            cy + cn
        }
        None =&gt; search_end(n, i + 1, ss),
    }
}

fn main() {
    for n in 1..S_BITS + 1 {
        println!("{}: {}", n, search(n, 1, vec![0, 1]));
    }
}


Cargo.toml

[package]
name = "correlations"
version = "0.1.0"
authors = ["Anders Kaseorg &lt;andersk@mit.edu&gt;"]

[dependencies]
rayon = "0.7.0"


Try it online!

I also have a slightly slower variant using very much less memory.