OFFSET
1,2
LINKS
Rémy Sigrist, Table of n, a(n) for n = 1..16384
Rémy Sigrist, Logarithmic scatterplot of (n, 1+a(n)) for n = 1..2^16
FORMULA
a(n) = 0 iff n is a square.
a(p) = p-1 for any odd prime number p.
EXAMPLE
For n = 12:
- we have the following values:
d 12/d d XOR (12/d)
-- ---- ------------
1 12 13
2 6 4
3 4 7
4 3 7
6 2 4
12 1 13
- hence a(12) = min({4, 7, 13}) = 4.
MAPLE
a:= n-> min(seq(Bits[Xor](d, n/d), d=numtheory[divisors](n))):
seq(a(n), n=1..100); # Alois P. Heinz, Oct 09 2019
MATHEMATICA
mvx[n_]:=Min[BitXor[#, n/#]&/@Divisors[n]]; Array[mvx, 80] (* Harvey P. Dale, Nov 04 2019 *)
PROG
(PARI) a(n) = vecmin(apply(d -> bitxor(d, n/d), divisors(n)))
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, Oct 06 2019
STATUS
approved