OFFSET
1,5
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
KEYWORD
base,nonn
AUTHOR
Leroy Quet, Sep 28 2009
EXTENSIONS
More terms from Max Alekseyev, Oct 01 2009
STATUS
approved