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.
%I A361942 #5 Apr 01 2023 08:54:12 %S A361942 1,1,2,1,3,2,3,1,4,3,2,3,4,3,4,1,5,4,3,4,5,2,3,4,5,4,5,3,5,4,5,1,6,5, %T A361942 4,5,3,5,4,5,6,5,2,5,6,3,4,5,6,5,6,4,6,5,3,4,6,5,6,4,6,5,6,1,7,6,5,6, %U A361942 4,6,5,6,7,3,5,6,4,6,5,6,7,6,5,6,7,2,5 %N A361942 For any number n >= 0 with binary expansion (b_1, ..., b_w), a(n) is the least p > 0 such that b_i = b_{p+i} for i = 1..w-p. %C A361942 Leading zeros in binary expansions of positive integers are ignored. %C A361942 This sequence is a variant of A302291 related to fractional powers of words. %C A361942 For any k > 0, the value k appears A045690(k) times in a(2^(k-1)), ..., a(2^k-1). %D A361942 Jean-Paul Allouche and Jeffrey Shallit, Automatic Sequences, Cambridge Univ. Press, 2003, p. 23. %H A361942 <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a> %F A361942 a(n) <= A302291(n). %F A361942 a(n) <= A070939(n) with equality iff n belongs to A091065. %F A361942 a(2^k-1) = 1 for any k >= 0. %F A361942 a(2^k) = k+1 for any k >= 0. %e A361942 The first terms, alongside the binary expansion of n split into chunks of length a(n), are: %e A361942 n a(n) bin(n) %e A361942 -- ---- ------ %e A361942 0 1 0 %e A361942 1 1 1 %e A361942 2 2 10 %e A361942 3 1 1|1 %e A361942 4 3 100 %e A361942 5 2 10|1 %e A361942 6 3 110 %e A361942 7 1 1|1|1 %e A361942 8 4 1000 %e A361942 9 3 100|1 %e A361942 10 2 10|10 %e A361942 11 3 101|1 %e A361942 12 4 1100 %e A361942 13 3 110|1 %e A361942 14 4 1110 %e A361942 15 1 1|1|1|1 %o A361942 (PARI) a(n) = { my (b = if (n, binary(n), [0])); for (p = 1, oo, if (b[1..#b-p] == b[1+p..#b], return (p););); } %Y A361942 Cf. A045690, A070939, A091065, A302291. %K A361942 nonn,base %O A361942 0,3 %A A361942 _Rémy Sigrist_, Mar 31 2023