%I #20 Jan 03 2021 19:46:59
%S 1,3,7,39,63,523,4983,25007,892217,1142775,1381311,1751751
%N Numbers n such that n divides the (right) concatenation of all numbers <= n written in base 2 (most significant digit on right).
%C This sequence differs from A029495 in that all least significant zeros are removed before concatenation.
%C No more terms < 10^7. [_Lars Blomberg_, Oct 17 2011]
%H <a href="/index/N#concat">Index entries for related sequences</a>
%e 1234567 -> (1)(01)(11)(001)(101)(011)(111) base 2 -> 1111110111111 base 2 = 8127 and 7 divides 8127.
%t b = 2; c = {}; Select[Range[10^4], Divisible[FromDigits[
%t c = Join[c, IntegerDigits[IntegerReverse[#, b], b]], b], #] &] (* _Robert Price_, Mar 07 2020 *)
%o # (Python)
%o def agen():
%o k, concat = 1, 1
%o while True:
%o if concat%k == 0: yield k
%o revbink_even = (bin(k+1)[2:])[::-1]
%o revbink_odd = '1' + revbink_even[1:]
%o add_str = revbink_even[revbink_even.index('1'):] + revbink_odd
%o concat = (concat << len(add_str)) + int(add_str, 2)
%o k += 2
%o g = agen()
%o print([next(g) for i in range(8)]) # _Michael S. Branicky_, Jan 03 2021
%Y Cf. A029447-A029470, A029471-A029494, A029495-A029518, A029519-A029542, A061931-A061954, A061955-A061978.
%K nonn,base,more
%O 1,2
%A Larry Reeves (larryr(AT)acm.org), May 24 2001
%E Edited and updated by Larry Reeves (larryr(AT)acm.org), Apr 12 2002
%E a(9)-a(12) from _Lars Blomberg_, Oct 17 2011
|