# [seqfan] Re: Formulas for two sequences, A060574 and A067498 ?

M. F. Hasler oeis at hasler.fr
Tue Mar 29 16:09:44 CEST 2022

```PS:  I apologize for giving first the formula for the moves (from
instead of this sequence A060574 (smallest disc on peg 1 after move n),
but later I also gave a formula for this one on OEIS:
It has even terms a(n = 3k) =: 2*b(floor(k/2))
and odd terms a(n = 3k+1) = a(3k+2) =: 1 + 2*c(k)
where both b(k) and c(k) are given as function of the even-indexed bits of k
(namely, the number of times one must divide k by 4 until it is odd, resp.
even).
This could be expressed as the 4-valuation of k with the odd-indexed bits
removed resp. filled through bitwise AND resp. OR with sufficiently large 1
+ 4 + 16 + 64 +... resp. 2 + 32 + 128 + ...).

This is certainly equivalent to the relations given by Jeffrey Shallit.

- Maximilian

On Tue, Mar 29, 2022 at 4:03 AM Antti Karttunen <antti.karttunen at gmail.com>
wrote:

> On 3/29/22, M. F. Hasler <oeis at hasler.fr> wrote:
> > Yes, for the tower of Hanoi there is a very simple algorithm that easily
> > translates to a formula : (...)

(And my thanks to all seqfans who have put effort to find a formula for
> A060574.)
>
>
>

```