login
Filter-sequence related to base-2 run-length encoding: a(n) = A046523(A243353(n)).
17

%I #28 Dec 01 2021 03:53:16

%S 1,2,4,2,4,8,6,2,4,12,16,8,6,12,6,2,4,12,36,12,16,32,24,8,6,30,24,12,

%T 6,12,6,2,4,12,36,12,36,72,60,12,16,48,64,32,24,72,24,8,6,30,60,30,24,

%U 48,60,12,6,30,24,12,6,12,6,2,4,12,36,12,36,72,60,12,36,180,144,72,60,180,60,12,16,48,144,48,64,128,96,32,24,120,216,72,24,72

%N Filter-sequence related to base-2 run-length encoding: a(n) = A046523(A243353(n)).

%H Antti Karttunen, <a href="/A278219/b278219.txt">Table of n, a(n) for n = 0..65537</a>

%F a(n) = A046523(A243353(n)).

%F a(n) = A278222(A003188(n)).

%F a(n) = A278220(1+A075157(n)).

%t f[n_, i_, x_] := Which[n == 0, x, EvenQ@ n, f[n/2, i + 1, x], True, f[(n - 1)/2, i, x Prime@ i]]; g[n_] := If[n == 1, 1, Times @@ MapIndexed[ Prime[First@ #2]^#1 &, Sort[FactorInteger[n][[All, -1]], Greater]]];

%t Table[g@ f[BitXor[n, Floor[n/2]], 1, 1], {n, 0, 93}] (* _Michael De Vlieger_, May 09 2017 *)

%o (Scheme) (define (A278219 n) (A046523 (A243353 n)))

%o (Python)

%o from sympy import prime, factorint

%o import math

%o def A(n): return n - 2**int(math.floor(math.log(n, 2)))

%o def b(n): return n + 1 if n<2 else prime(1 + (len(bin(n)[2:]) - bin(n)[2:].count("1"))) * b(A(n))

%o def a005940(n): return b(n - 1)

%o def P(n):

%o f = factorint(n)

%o return sorted([f[i] for i in f])

%o def a046523(n):

%o x=1

%o while True:

%o if P(n) == P(x): return x

%o else: x+=1

%o def a003188(n): return n^int(n/2)

%o def a243353(n): return a005940(1 + a003188(n))

%o def a(n): return a046523(a243353(n)) # _Indranil Ghosh_, May 07 2017

%Y Cf. A003188, A046523, A075157, A243353, A278220.

%Y Other base-2 related filter sequences: A278217, A278222.

%Y Sequences that (seem to) partition N into same or coarser equivalence classes are at least these: A005811, A136004, A033264, A037800, A069010, A087116, A090079 and many others like A105500, A106826, A166242, A246960, A277561, A037834, A225081 although these have not been fully checked yet.

%K nonn

%O 0,2

%A _Antti Karttunen_, Nov 16 2016