login

Revision History for A342242

(Bold, blue-underlined text is an addition; faded, red-underlined text is a deletion.)

Showing entries 1-10 | older changes
For any n > 0, a(n) is the least positive number whose binary expansion is both a prefix and a suffix of the binary expansion of n; a(0) = 0.
(history; published version)
#11 by N. J. A. Sloane at Sun Mar 07 17:46:42 EST 2021
STATUS

proposed

approved

#10 by Rémy Sigrist at Sun Mar 07 15:22:25 EST 2021
STATUS

editing

proposed

#9 by Rémy Sigrist at Sun Mar 07 15:03:57 EST 2021
LINKS

Rémy Sigrist, <a href="/A342242/b342242.txt">Table of n, a(n) for n = 0..8192</a>

STATUS

approved

editing

Discussion
Sun Mar 07
15:22
Rémy Sigrist: added b-file
#8 by N. J. A. Sloane at Sun Mar 07 14:42:07 EST 2021
STATUS

proposed

approved

#7 by Rémy Sigrist at Sun Mar 07 14:14:55 EST 2021
STATUS

editing

proposed

#6 by Michael S. Branicky at Sun Mar 07 11:33:04 EST 2021
PROG

(Python)

def a(n):

b = bin(n)[2:]

for i in range(1, len(b)+1):

if b[:i] == b[-i:]: return int(b[:i], 2)

print([a(n) for n in range(80)]) # Michael S. Branicky, Mar 07 2021

#5 by Rémy Sigrist at Sun Mar 07 11:01:18 EST 2021
EXAMPLE

For n = 814:

- the binary expansion of 814 is "1100101110",

- "1" does not match "0",

- "11" does not match "10",

- "110" matches "110",

- so the binary representation of a(814) is "110",

- and a(814) = 6.

#4 by Rémy Sigrist at Sun Mar 07 08:10:24 EST 2021
COMMENTS

All terms belong to A091065.

FORMULA

a(a(n)) = a(n).

#3 by Rémy Sigrist at Sun Mar 07 08:08:27 EST 2021
FORMULA

a(n) <= n with equality iff n belongs to A091065.

a(n) = n mod 2^A342241(n).

CROSSREFS
#2 by Rémy Sigrist at Sun Mar 07 06:21:24 EST 2021
NAME

allocated for Rémy Sigrist

For any n > 0, a(n) is the least positive number whose binary expansion is both a prefix and a suffix of the binary expansion of n; a(0) = 0.

DATA

0, 1, 2, 1, 4, 1, 6, 1, 8, 1, 2, 1, 12, 1, 14, 1, 16, 1, 2, 1, 20, 1, 2, 1, 24, 1, 26, 1, 28, 1, 30, 1, 32, 1, 2, 1, 4, 1, 2, 1, 40, 1, 2, 1, 44, 1, 2, 1, 48, 1, 50, 1, 52, 1, 6, 1, 56, 1, 58, 1, 60, 1, 62, 1, 64, 1, 2, 1, 4, 1, 2, 1, 72, 1, 2, 1, 4, 1, 2, 1

OFFSET

0,3

LINKS

<a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a>

FORMULA

a(n) = 1 iff n is an odd number.

PROG

(PARI) a(n) = { my (b=if (n, binary(n), [0])); for (w=1, oo, if (b[1..w]==b[#b+1-w..#b], return (fromdigits(b[1..w], 2)))) }

CROSSREFS

Cf. A342241.

KEYWORD

allocated

nonn,base,easy

AUTHOR

Rémy Sigrist, Mar 07 2021

STATUS

approved

editing