login
A295087
Distinct values in A002487 in the order of appearance.
2
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, 24, 27, 30, 34, 31, 20, 28, 33, 37, 32, 35, 41, 40, 47, 43, 44, 36, 39, 49, 46, 50, 55, 45, 38, 52, 51, 60, 53, 57, 48, 42, 56, 67, 63, 69, 76, 65, 61, 68, 58, 71, 64
OFFSET
1,3
COMMENTS
This sequence is a permutation of the nonnegative integers, with inverse A295088.
FORMULA
a(n) = A002487(A091945(n)).
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)
A295087_list = list(islice(A295087_gen(), 20)) # Chai Wah Wu, May 18 2023
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