login
This site is supported by donations to The OEIS Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A165818 Largest integer coprime to n whose binary representation is a substring of the binary representation of n. 0
1, 1, 1, 1, 2, 1, 3, 1, 4, 1, 5, 1, 6, 3, 7, 1, 8, 1, 9, 1, 10, 5, 11, 1, 12, 5, 13, 3, 14, 7, 15, 1, 16, 1, 17, 1, 18, 9, 19, 1, 20, 5, 21, 5, 22, 11, 23, 1, 24, 9, 25, 5, 26, 13, 27, 3, 28, 13, 29, 7, 30, 15, 31, 1, 32, 1, 33, 1, 34, 17, 35, 1, 36, 9, 37, 9, 38, 19, 39, 1, 40, 9, 41, 5, 42, 21 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,5

LINKS

Table of n, a(n) for n=1..86.

EXAMPLE

14 in binary is 1110. The integers that, when written in binary, occur as substrings in 1110 are 0, 1, 2 (10 in binary), 3 (11 in binary), 6 (110 in binary), 7 (111 in binary), and 14 (1110 in binary). Of these, 3 is the largest that is coprime to 14. So a(14) = 3.

PROG

(PARI) { a(n) = my(m, b, s); m=0; b=binary(n); for(i=1, #b, for(j=i, #b, s=sum(k=i, j, b[k]*2^(j-k)); if(gcd(s, n)==1&&m<s, m=s) )); m } /* Max Alekseyev, Oct 01 2009 */

CROSSREFS

Sequence in context: A308073 A090331 A229994 * A194746 A198336 A290980

Adjacent sequences:  A165815 A165816 A165817 * A165819 A165820 A165821

KEYWORD

base,nonn

AUTHOR

Leroy Quet, Sep 28 2009

EXTENSIONS

More terms from Max Alekseyev, Oct 01 2009

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified June 17 16:56 EDT 2019. Contains 324196 sequences. (Running on oeis4.)