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.

A079471 Fixed points of reversed binary words in reversed lexicographic order.

This page as a plain text file.
%I A079471 #18 Feb 18 2024 01:26:01
%S A079471 0,1,6,10,18,34,60,66,92,108,116,130,156,172,180,204,212,228,258,284,
%T A079471 300,308,332,340,356,396,404,420,452,514,540,556,564,588,596,612,652,
%U A079471 660,676,708,780,788,804,836,900,1026,1052,1068,1076,1100,1108,1124
%N A079471 Fixed points of reversed binary words in reversed lexicographic order.
%C A079471 These are 0 and the words where the bit count is 2^i where i is the index of the lowest set bit.
%H A079471 Paolo Xausa, <a href="/A079471/b079471.txt">Table of n, a(n) for n = 0..10000</a>
%H A079471 Joerg Arndt, <a href="http://www.jjj.de/fxt/fxtpage.html#fxtbook">Fxtbook</a>, section 1.26.4 "The sequence of fixed points", p.73-74
%e A079471 Zero is a fixed point: 0: ...........
%e A079471 The next few in decimal and binary form (dots for zeros), lowest (rightmost) bit has index zero are:
%e A079471 1: ............1
%e A079471 6: ..........11.
%e A079471 10: ........1.1.
%e A079471 18: .......1..1.
%e A079471 34: ......1...1.
%e A079471 60: ......1111..
%e A079471 66: .....1....1.
%e A079471 92: .....1.111..
%e A079471 108: ....11.11..
%e A079471 116: ....111.1..
%e A079471 130: ...1.....1.
%t A079471 Join[{0},Select[Range[10^4],DigitCount[#,2,1]==2^IntegerExponent[#,2]&]] (* _Paolo Xausa_, Nov 13 2023 *)
%o A079471 (C++)
%o A079471 /* Generate the binary words lex order:
%o A079471   start with zero and get successive elements via */
%o A079471 inline ulong prev_lexrev(ulong x)
%o A079471 /* Return previous word in (reversed) lex order. */
%o A079471 {
%o A079471   ulong x0 = x & -x;
%o A079471   if ( x & (x0<<1) ) x ^= x0;
%o A079471   else { x0 ^= (x0<<1); x ^= x0; x |= 1; }
%o A079471   return x;
%o A079471 }
%o A079471 /* To extract the fixed points, select those where
%o A079471    the following function returns a nonzero value: */
%o A079471 ulong is_lexrev_fixed_point(ulong x)
%o A079471 /* Return whether x is a fixed point in the prev_lexrev() - sequence */
%o A079471 {
%o A079471   if ( x & 1 ) { if ( 1==x ) return 1; else return 0; }
%o A079471   else
%o A079471   {
%o A079471     ulong w = bit_count(x);
%o A079471     if ( w != (w & -w) ) return 0;
%o A079471     if ( 0==x ) return 1; return ( (x & -x) & w );
%o A079471   }
%o A079471 }
%K A079471 easy,nonn
%O A079471 0,3
%A A079471 _Joerg Arndt_, Jan 15 2003