Let $n$ be an odd positive integer, Let $o=\operatorname{ord}_n 2$ be the order of 2 modulo $n$ and $m$ the period of $1/n, k$ is number of distinct odd residues contained in set $\{2^1,2^2,...,2^{n−1}\}$ modulo $n$.
If $o,m$ and $k$ in the set $\{2,4,8,...\}$ and $k$ divide $n-1$, then $n$ is item in the sequence $17, 257, 641, 65537, …$.
It seems all known items in the sequence are Fermat factors, How come?
P.S.: $167772161$ also is item in the sequence, could someone have a full check between $65537$ and $167772161$?
this is a copy of my answer which I gave originally on math-overflow, where possibly your question shall be closed soon. There has also been an initial description of an iterative procedure to compute your set of numbers - I'm referring to that description here
You give a game of iteration on numbers, which I'd like to rewrite for some given positive odd number $z$ and an initial $a=1$ :
$$ b = {z+a\over 2^A } \tag 1 $$ where $A$ is taken such that $b$ is odd again.
You iterate that formula until this cycles: $$ c = {z+b\over 2^B } \qquad d = {z+c\over 2^C } \qquad \cdots \qquad a = {z+h\over 2^H } \tag 2 $$ Let us denote the number of iterates with $N$ and the sum of exponents $S=A+B+C+\cdots+H$ .
You wonder now about the observation that some numbers $z$ satisfy multiple conditions: that $N$ is a power of $2$, that $S$ is a power of $2$, (and about the period in decimal expansion of $1/z$ but which I shall not discuss here).
Let us look at some simple to detect properties.
What numbers $z$ have a cycle of $N=1$ ?
this means $b=a$ and constructing a formula gives (here is $S=A$) $$\begin{array}{rll} a &= { z+a\over 2^S } \\ a2^S &= z+a \\ z &=a(2^S-1) \end{array} \tag {3.1} $$ $\qquad \qquad $ Assuming $ a=1 $ gives the set of solutions $$ \begin{array}{rll} z &\in \{1,3,7,15,\ldots\} \\ A=S &\in \{1,2,3,4,\ldots\} \end{array} \tag {3.2} $$
What numbers $z$ have a cycle of $N=2$ ?
this means $c=a$ in definition (2) and a formula gives (here $S=A+B$) $$\begin{array}{rll} b &= { z+a\over 2^A } && a &= { z+b\over 2^B } \\ a &= { z+{ z+a\over 2^A }\over 2^B } & = { z2^A+ z+a \over 2^{A+B} } \\ a2^S -a &= z2^A+ z \\ z &= a{ 2^S-1 \over 2^A+1 } & \left(= a{ (2^S-1)(2^{A}-1) \over 2^{2A}-1 }\right) \end{array} \tag {4.1} $$ $\qquad \qquad $ Assuming $ a=1 $ gives the set of solutions $$ \Tiny \begin{array}{rr|ll} z & S & A & B \\ \hline 1 & 2 & 1 & 1 \\ 5 & 4 & 1 & 3 \\ 21 & 6 & 1 & 5 \\ \vdots & \vdots & \vdots & \vdots \\ \hline 3 & 4 & 2 & 2 \\ 51 & 8 & 2 & 6 \\ \vdots & \vdots & \vdots & \vdots \\ \hline 7 & 6 & 3 & 3 \\ 455 & 12 & 3 & 9 \\ \vdots & \vdots & \vdots & \vdots \\ \hline 15 & 8 & 4 & 4 \\ 3855 & 16 & 4 & 12 \\ 986895 & 24 & 4 & 20 \\ \vdots & \vdots & \vdots & \vdots \\ \hline 31 & 10 & 5 & 5 \\ 31775 & 20 & 5 & 15 \\ 32537631 & 30 & 5 & 25 \\ \vdots & \vdots & \vdots & \vdots \\ \hline 63 & 12 & 6 & 6 \\ 258111 & 24 & 6 & 18 \\ 1057222719 & 36 & 6 & 30 \\ \vdots & \vdots & \vdots & \vdots \\ \end{array} \tag {4.2} $$ This table displays easy to recognize patterns for setting up formulae for $z$ and $S,A,B$ for the $N=2$ case. One shot is surely
$$ S=2A\cdot k \qquad \implies z={2^{2kA}-1\over2^A+1}= {(2^{2kA}-1)(2^{A}-1)\over 2^{2A}-1}$$
and the left parenthese is always divisible by the denominator.
For a better example: just to look at your question of $N=2^j$ && $ S=2^k$ for positive $j \le k$ we can extract cases for $j=1$, $N=2^j=2$ first
$$ \Tiny \begin{array}{rr|ll} z & S & A & B \\ \hline 1 & 2 & 1 & 1 \\ 5 & 4 & 1 & 3 \\ 3 & 4 & 2 & 2 \\ 85 & 8 & 1 & 7 \\ 51 & 8 & 2 & 6 \\ 15 & 8 & 4 & 4 \\ 21845 & 16 & 1 & 15 \\ 13107 & 16 & 2 & 14 \\ 3855 & 16 & 4 & 12 \\ 255 & 16 & 8 & 8 \\ 1431655765 & 32 & 1 & 31 \\ 858993459 & 32 & 2 & 30 \\ 252645135 & 32 & 4 & 28 \\ 16711935 & 32 & 8 & 24 \\ 65535 & 32 & 16 & 16 \\ 6148914691236517205 & 64 & 1 & 63 \\ 3689348814741910323 & 64 & 2 & 62 \\ 1085102592571150095 & 64 & 4 & 60 \\ 71777214294589695 & 64 & 8 & 56 \\ 281470681808895 & 64 & 16 & 48 \\ 4294967295 & 64 & 32 & 32 \\ \vdots & \vdots & \vdots & \vdots \\ \end{array} \tag {4.3} $$
As by (4.1) with $a=1$ and $S=2^k$ we have analytically
$$\begin{array}{rll} z &= { 2^{2^k}-1 \over 2^A+1 } \\ &= { (2^{2^{k-1}}+1)(2^{2^{k-2}}+1)...(2^1+1)(2^1-1)\over 2^{A}+1 } &= { 3 \cdot 5 \cdot 17 \cdot 257 \cdot \ldots \cdot(2^{2^{k-1}}+1)\over 2^{A}+1 } \end{array} \tag {4.4} $$
Because the parentheses in the numerator have no common factor, we can draw conclusions of possible $A$ in the denominator to make the fraction an integer value. (Empirically we can observe that all $A$ are perfect powers of $2$ and it is surely not difficult to prove this)
This can analoguously be extended to larger cycle-lengthes $N>2$ . It might furtherly be useful, to introduce a notation which combines the set of exponents $A,B,C,...$ with the resulting integer value $z$ in a fully compacted form, say $$ z = T(A_1,A_2,A_3,...,A_N) \tag 5$$ and look, for instance, at solutions $z$ for typical patterns of the exponents, like $z=T(1,1,1,...,1)$ or $z=T(1,1,...1,A_N)$ with $A_N\gt 1$ and $S=N-1+A$ to develop short formulae for the integer solutions.
I'm not going deeper into this nice game, but leave it to you as a suggestion how to approach analytical answers to your questions.