OFFSET
1,3
COMMENTS
This sequence is a permutation of the nonnegative integers, with inverse A295088.
LINKS
EXAMPLE
The first terms of this sequence, alongside the first terms of A002487, are:
n a(n) fusc(k) k
-- ---- ------- --
1 0 0 0
2 1 1 1
. . 1 2
3 2 2 3
. . 1 4
4 3 3 5
. . 2 6
. . 3 7
. . 1 8
5 4 4 9
. . 3 10
6 5 5 11
. . 2 12
. . 5 13
. . 3 14
. . 4 15
. . 1 16
. . 5 17
. . 4 18
7 7 7 19
. . 3 20
8 8 8 21
. . 5 22
. . 7 23
PROG
(PARI) fusc(n)=local(a=1, b=0); while(n>0, if(bitand(n, 1), b+=a, a+=b); n>>=1); b \\ after Charles R Greathouse IV at A002487
s=0; for (n=0, 621, v=fusc(n); if(!bittest(s, v), print1(v", "); s+=2^v))
(Python)
from functools import reduce
from itertools import count, islice
def A295087_gen(): # generator of terms
s = {0}
yield 0
for n in count(1):
if (m:=sum(reduce(lambda x, y:(x[0], x[0]+x[1]) if int(y) else (x[0]+x[1], x[1]), bin(n)[-1:2:-1], (1, 0)))) not in s:
yield m
s.add(m)
CROSSREFS
KEYWORD
nonn
AUTHOR
Rémy Sigrist, Nov 14 2017
EXTENSIONS
Formula adapted after change in A091945 by Rémy Sigrist, Dec 07 2022
STATUS
approved