|
|
A143113
|
|
a(n) = the smallest positive integer that is coprime to n and has the same number of 1's in its binary representation as n has in binary.
|
|
2
|
|
|
1, 1, 5, 1, 3, 5, 11, 1, 5, 3, 7, 5, 7, 11, 23, 1, 3, 5, 7, 3, 11, 7, 15, 5, 7, 7, 23, 11, 15, 23, 47, 1, 5, 3, 11, 5, 7, 7, 23, 3, 7, 11, 15, 7, 23, 15, 31, 5, 11, 7, 23, 7, 15, 23, 31, 11, 23, 15, 31, 23, 31, 47, 95, 1, 3, 5, 7, 3, 7, 11, 15, 5, 7, 7, 23, 7, 15, 23, 31, 3, 7, 7, 15, 11
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,3
|
|
LINKS
|
|
|
EXAMPLE
|
For n = 27: 27 in binary is 11011, which has four 1's. The positive integers that each have four 1's in their binary representations are 15,23,27,29, etc. The smallest of these that is coprime to 27 is 23. So a(27) = 23.
|
|
MATHEMATICA
|
cp[n_]:=Module[{k=1, dcn=DigitCount[n, 2, 1]}, While[!CoprimeQ[n, k] || DigitCount[ k, 2, 1] != dcn, k++]; k]; Array[cp, 90] (* Harvey P. Dale, Aug 13 2012 *)
|
|
CROSSREFS
|
|
|
KEYWORD
|
base,nonn
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|