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.

A115510 a(1)=1. a(n) is smallest positive integer not occurring earlier in the sequence such that a(n) and a(n-1) have at least one 1-bit in the same position when they are written in binary.

This page as a plain text file.
%I A115510 #27 Mar 25 2022 15:02:22
%S A115510 1,3,2,6,4,5,7,9,8,10,11,12,13,14,15,17,16,18,19,20,21,22,23,24,25,26,
%T A115510 27,28,29,30,31,33,32,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,
%U A115510 50,51,52,53,54,55,56,57,58,59,60,61,62,63,65,64,66,67,68,69,70,71,72
%N A115510 a(1)=1. a(n) is smallest positive integer not occurring earlier in the sequence such that a(n) and a(n-1) have at least one 1-bit in the same position when they are written in binary.
%C A115510 Sequence is a permutation of the positive integers. A115511 is the inverse permutation.
%C A115510 This can be regarded as a set-theoretic analog of A064413. - _N. J. A. Sloane_, Sep 06 2021
%H A115510 Michael De Vlieger, <a href="/A115510/b115510.txt">Table of n, a(n) for n = 1..1025</a>
%F A115510 (4,6,5) is a 3-cycle and (2^k,2^k+1) for k = 1 and k > 2 are 2-cycles; all other numbers are fixed points. - _Klaus Brockhaus_, Jan 24 2006
%F A115510 In other words, a(2^k)=2^k+1 for k >= 3, a(2^k+1) = 2^k for k>=3, and otherwise a(n) = n for n >= 7. - _N. J. A. Sloane_, Mar 25 2022
%e A115510 a(3) = 2 = 10 in binary. Among the positive integers not occurring among the first 3 terms of the sequence (4 = 100 in binary, 5 = 101 in binary, 6 = 110 in binary,...), 6 is the smallest that shares at least one 1-bit with a(3) when written in binary. So a(4) = 6.
%t A115510 Block[{a = {1}, k}, Do[k = 1; While[Or[BitAnd[Last@ a, k ] == 0, MemberQ[a, k]], k++]; AppendTo[a, k], {71}]; a] (* _Michael De Vlieger_, Sep 07 2017 *)
%o A115510 (Python)
%o A115510 A115510_list, l1, s, b = [1], 1, 2, set()
%o A115510 for _ in range(10**6):
%o A115510     i = s
%o A115510     while True:
%o A115510         if not i in b and i & l1:
%o A115510             A115510_list.append(i)
%o A115510             l1 = i
%o A115510             b.add(i)
%o A115510             while s in b:
%o A115510                 b.remove(s)
%o A115510                 s += 1
%o A115510             break
%o A115510         i += 1 # _Chai Wah Wu_, Sep 24 2021
%Y A115510 Cf. A064413, A109812, A115511, A226077.
%K A115510 easy,base,nonn
%O A115510 1,2
%A A115510 _Leroy Quet_, Jan 23 2006
%E A115510 More terms from _Klaus Brockhaus_, Jan 24 2006