OFFSET
1,2
COMMENTS
The divisors of n counted in A038548(n) are sorted, each divisor is represented by a digit of 1 to 4, and these digits are concatenated to form the decimals of a(n).
The parity digits are 1,2,3,4 and are mapped as follows:
1: odd factor of an odd number
2: even factor of an even number, paired with an even factor
3: odd factor of an even number
4: even factor of an even number, paired with an odd factor
a(n) gives the significant or first half of the parity of n.
LINKS
Antti Karttunen, Table of n, a(n) for n = 1..16384
G. R. Bryant, Divisor 4 Parity
FORMULA
a(odd prime) = 1. - Michel Marcus, Jul 05 2018
EXAMPLE
For n=24, 24 has the following divisors: {1, 2, 3, 4, 6, 8, 12, 24} with the following divisor pairings {{1,24}, {2,12}, {3,8}, {4,6}}.
The first divisor is 1, odd, and paired with an even, so we have: 3;
the second divisor is 2, even, and paired with an even, so we have: 2;
the third divisor is 3, odd, and paired with an even, so we have: 3;
the fourth divisor is 4, even, and paired with an even, so we have: 2.
That gives us the significant portion of the parity as 3232. (The full parity would include the complement and be 32322424.)
MATHEMATICA
Table[FromDigits[Map[Boole[OddQ@ #] & /@ {#, n/#} &, Take[#, Ceiling[Length[#]/2]] &@ Divisors@ n] /. {{1, 1} -> 1, {0, 0} -> 2, {1, 0} -> 3, {0, 1} -> 4}], {n, 100}] (* Michael De Vlieger, May 03 2018 *)
PROG
(PARI) par(d, nd) = if (d % 2, if (nd % 2, 1, 3), if (nd % 2, 4, 2));
a(n) = my(s=""); fordiv (n, d, if (d <= n/d, s = concat(s, par(d, n/d)))); eval(s); \\ Michel Marcus, Jul 05 2018
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Gregory Bryant, Apr 30 2018
STATUS
approved