login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A061931
Numbers n such that n divides the (right) concatenation of all numbers <= n written in base 2 (most significant digit on right).
143
1, 3, 7, 39, 63, 523, 4983, 25007, 892217, 1142775, 1381311, 1751751
OFFSET
1,2
COMMENTS
This sequence differs from A029495 in that all least significant zeros are removed before concatenation.
No more terms < 10^7. [Lars Blomberg, Oct 17 2011]
EXAMPLE
1234567 -> (1)(01)(11)(001)(101)(011)(111) base 2 -> 1111110111111 base 2 = 8127 and 7 divides 8127.
MATHEMATICA
b = 2; c = {}; Select[Range[10^4], Divisible[FromDigits[
c = Join[c, IntegerDigits[IntegerReverse[#, b], b]], b], #] &] (* Robert Price, Mar 07 2020 *)
PROG
(Python)
def agen():
k, concat = 1, 1
while True:
if concat%k == 0: yield k
revbink_even = (bin(k+1)[2:])[::-1]
revbink_odd = '1' + revbink_even[1:]
add_str = revbink_even[revbink_even.index('1'):] + revbink_odd
concat = (concat << len(add_str)) + int(add_str, 2)
k += 2
g = agen()
print([next(g) for i in range(8)]) # Michael S. Branicky, Jan 03 2021
KEYWORD
nonn,base,more
AUTHOR
Larry Reeves (larryr(AT)acm.org), May 24 2001
EXTENSIONS
Edited and updated by Larry Reeves (larryr(AT)acm.org), Apr 12 2002
a(9)-a(12) from Lars Blomberg, Oct 17 2011
STATUS
approved