login
If n <= 16, a(n) = n; for n > 16: a(16n + 6) = 16*n + 9, and for other cases with n > 16: a(2n) = 2*a(n), a(2n+1) = 2*a(n) + 1.
3

%I #12 Jun 11 2015 08:23:01

%S 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,25,23,24,25,

%T 26,27,28,29,30,31,32,33,34,35,36,37,41,39,40,41,42,43,50,51,46,47,48,

%U 49,50,51,52,53,57,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,73,71,72,73,74,75,82,83,78,79,80,81,82,83,84,85,89,87,100

%N If n <= 16, a(n) = n; for n > 16: a(16n + 6) = 16*n + 9, and for other cases with n > 16: a(2n) = 2*a(n), a(2n+1) = 2*a(n) + 1.

%C Function a(n) rewrites in the binary representation of n the rightmost occurrence of substring "0110" to "1001", provided at least one such substring is present, otherwise fixes n.

%C The values 224694 and 486838 shown in the example section are capless and one-capped binary boundary codes for seven-hex polyhex-configuration called "crown" (the name employed for example in Guo et al paper) and the resulting values are the respective codes for one hex smaller polyhexes. The crown is one of the polyhexes that are too round that the related recurrence A254109 could make any dent in their boundary. Together with the latter can be used to obtain the terms of A258012, please see comments there.

%H Antti Karttunen, <a href="/A258009/b258009.txt">Table of n, a(n) for n = 0..8191</a>

%H Guo, Hansen, Zheng, <a href="http://dx.doi.org/10.1016/S0166-218X(01)00180-9">Boundary uniqueness of fusenes</a>, Discrete Applied Mathematics 118 (2002), pp. 209-222.

%F If n <= 16, a(n) = n; for n > 16: a(16n + 6) = 16*n + 9, and for other cases with n > 16: a(2n) = 2*a(n), a(2n+1) = 2*a(n) + 1.

%e For n = 224694 ("110110110110110110" in binary) we rewrite the rightmost "0110" to "1001" resulting "110110110110111001" in binary, which is 224697 in decimal, thus a(224694) = 224697.

%e For n = 486838 ("1110110110110110110" in binary) we rewrite the rightmost "0110" to "1001" resulting "1110110110110111001" in binary, which is 486841 in decimal, thus a(486838) = 486841.

%o (Scheme, two variants, the first one utilizing a memoizing definec-macro)

%o (definec (A258009 n) (cond ((<= n 16) n) ((= 6 (modulo n 16)) (+ 9 (* 16 (floor->exact (/ n 16))))) (else (+ (modulo n 2) (* 2 (A258009 (floor->exact (/ n 2))))))))

%o ;; Faster, iterative version:

%o (define (A258009 n) (let loop ((n n) (s 0) (p2 1)) (cond ((<= n 16) (+ (* p2 n) s)) ((= 6 (modulo n 16)) (+ (* p2 16 (floor->exact (/ n 16))) s (* p2 9))) ((even? n) (loop (/ n 2) s (+ p2 p2))) (else (loop (/ (- n 1) 2) (+ s p2) (+ p2 p2))))))

%Y Cf. A254109, A258012.

%K nonn,base

%O 0,3

%A _Antti Karttunen_, May 31 2015