%I #26 May 19 2023 07:01:49
%S 0,1,2,3,4,5,7,8,6,9,11,10,13,12,14,15,18,17,19,21,16,23,22,26,29,25,
%T 24,27,30,34,31,20,28,33,37,32,35,41,40,47,43,44,36,39,49,46,50,55,45,
%U 38,52,51,60,53,57,48,42,56,67,63,69,76,65,61,68,58,71,64
%N Distinct values in A002487 in the order of appearance.
%C This sequence is a permutation of the nonnegative integers, with inverse A295088.
%H Rémy Sigrist, <a href="/A295087/b295087.txt">Table of n, a(n) for n = 1..10000</a>
%H <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>
%H <a href="/index/St#Stern">Index entries for sequences related to Stern's sequences</a>
%F a(n) = A002487(A091945(n)).
%e The first terms of this sequence, alongside the first terms of A002487, are:
%e n a(n) fusc(k) k
%e -- ---- ------- --
%e 1 0 0 0
%e 2 1 1 1
%e . . 1 2
%e 3 2 2 3
%e . . 1 4
%e 4 3 3 5
%e . . 2 6
%e . . 3 7
%e . . 1 8
%e 5 4 4 9
%e . . 3 10
%e 6 5 5 11
%e . . 2 12
%e . . 5 13
%e . . 3 14
%e . . 4 15
%e . . 1 16
%e . . 5 17
%e . . 4 18
%e 7 7 7 19
%e . . 3 20
%e 8 8 8 21
%e . . 5 22
%e . . 7 23
%o (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
%o s=0; for (n=0, 621, v=fusc(n); if(!bittest(s,v), print1(v", "); s+=2^v))
%o (Python)
%o from functools import reduce
%o from itertools import count, islice
%o def A295087_gen(): # generator of terms
%o s = {0}
%o yield 0
%o for n in count(1):
%o 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:
%o yield m
%o s.add(m)
%o A295087_list = list(islice(A295087_gen(),20)) # _Chai Wah Wu_, May 18 2023
%Y Cf. A002487, A091945, A295088.
%K nonn
%O 1,3
%A _Rémy Sigrist_, Nov 14 2017
%E Formula adapted after change in A091945 by _Rémy Sigrist_, Dec 07 2022