# Recurrence relation for A043569?

Emeric Deutsch deutsch at duke.poly.edu
Sat Apr 22 03:45:06 CEST 2006

```Here is an elementary - not necessarily the simplest - Maple program:

a:=proc(n) local nn,nd: nn:=convert(n,base,2):
nd:={seq(nn[j]-nn[j-1],j=2..nops(nn))}: if n=2 then 2 elif nd={0,1} then n
else fi end: seq(a(n),n=1..2100);

It does the following: for a given n:
nn is n in base 2;
nd is the SET of the differences of the successive terms of nn;
if nd={0,1} then nn has exactly 2 runs;
n=2 had to be handled separately because, although it has 2 runs,
we have nd={1}.

Emeric Deutsch

On Fri, 21 Apr 2006, Alonso Del Arte wrote:

> I've just sent through the form a Mathematica command to calculate the
> terms of A043569. It involves multiplying Mersenne numbers by powers
> of 2 and sorting. It works but it's not terribly elegant.
>
> Is there a recurrence relation for this sequence? I've tried several
> different things along the lines of
>
> a(1) = 2, a(n) = a(n -1) + log_2 a(n - 1) + log_2 a(n - 2) etc., etc.,
>
> and they work except after a(n - 1) becomes a power of two, or before.
> Any suggestions?
>
> Al
>
>

```