cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A295897 Numbers in whose binary expansion there are no 1-runs of odd length followed by a 0 to their right.

This page as a plain text file.
%I A295897 #33 Apr 25 2025 10:53:16
%S A295897 0,1,3,6,7,12,13,15,24,25,27,30,31,48,49,51,54,55,60,61,63,96,97,99,
%T A295897 102,103,108,109,111,120,121,123,126,127,192,193,195,198,199,204,205,
%U A295897 207,216,217,219,222,223,240,241,243,246,247,252,253,255,384,385,387,390,391,396,397,399,408,409,411,414,415,432
%N A295897 Numbers in whose binary expansion there are no 1-runs of odd length followed by a 0 to their right.
%C A295897 No runs of 1-bits of odd length allowed in the binary expansion of n (A007088), except that when n is an odd number, then the rightmost run may have an odd length. Subsequence A277335 does not allow that exception.
%C A295897 A005940(1+a(n)) yields a permutation of A028982, squares and twice squares.
%C A295897 Running maximum without repetition of the decimal equivalent of Gray code for n (A003188). - _Frédéric Nouvier_, Aug 14 2020
%H A295897 Antti Karttunen, <a href="/A295897/b295897.txt">Table of n, a(n) for n = 1..10000</a>
%H A295897 <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a>
%F A295897 a(n) = A003714(n-1) XOR ( A003714(n-1) >> 1 ). - _Frédéric Nouvier_, Aug 14 2020
%o A295897 (Scheme, with _Antti Karttunen_'s IntSeq-library)
%o A295897 (define A295897 (NONZERO-POS 1 0 A295896))
%o A295897 (Rust)
%o A295897 fn main() {
%o A295897     for i in (0..2048)
%o A295897         // Filter to get A003714
%o A295897         .filter(|n| n & (n << 1) == 0)
%o A295897         // Map to produce A295897
%o A295897         .map(|n| n ^ (n >> 1))
%o A295897     {
%o A295897         println!("{}", i);
%o A295897     }
%o A295897 } // _Frédéric Nouvier_, Aug 14 2020
%o A295897 (Python)
%o A295897 [x ^ (x>>1) for x in range(0,2048) if (x & (x<<1) == 0)]
%o A295897 # _Frédéric Nouvier_, Aug 14 2020
%o A295897 (Python)
%o A295897 def A295897(n):
%o A295897     tlist, s = [1,2], 0
%o A295897     while tlist[-1]+tlist[-2] <= n: tlist.append(tlist[-1]+tlist[-2])
%o A295897     for d in tlist[::-1]:
%o A295897         s <<= 1
%o A295897         if d <= n:
%o A295897             s += 1
%o A295897             n -= d
%o A295897     return s>>1^s # _Chai Wah Wu_, Apr 25 2025
%Y A295897 Cf. A005940, A028982, A280873.
%Y A295897 Subsequence of A004760.
%Y A295897 Cf. A277335 (a subsequence).
%Y A295897 Cf. A295896 (characteristic function).
%K A295897 nonn,base
%O A295897 1,3
%A A295897 _Antti Karttunen_, Dec 01 2017