OFFSET
1,3
COMMENTS
Every number can be represented uniquely as a product of numbers of the form p^(2^k), sequence A050376. This sequence is a binary representation of this factorization, with a(p^(2^k)) = 2^(i-1), where i is the index (A302778) of p^(2^k) in A050376. Additive with a(p^e) = sum a(p^(2^e_k)) where e = sum(2^e_k) is the binary representation of e and a(p^(2^k)) is as described above. - Franklin T. Adams-Watters, Oct 25 2005 - Index offset corrected by Antti Karttunen, Apr 17 2018
LINKS
FORMULA
a(1)=0; a(n*A050376(k)) = a(n) + 2^k for a(n) < 2^k, k=0, 1, ... - Thomas Ordowski, Mar 23 2005
From Antti Karttunen, Apr 13 2018: (Start)
a(n) = A064358(n)-1.
(End)
EXAMPLE
n = 84 has Fermi-Dirac factorization A050376(5) * A050376(3) * A050376(2) = 7*4*3. Thus a(84) = 2^(5-1) + 2^(3-1) + 2^(2-1) = 16 + 4 + 2 = 22 ("10110" in binary = A182979(84)). - Antti Karttunen, Apr 17 2018
PROG
(PARI) A052331=a(n)={for(i=1, #n=factor(n)~, n[2, i]>1||next; m=binary(n[2, i]); n=concat(n, Mat(vector(#m-1, j, [n[1, i]^2^(#m-j), m[j]]~))); n[2, i]%=2); n||return(0); m=vecsort(n[1, ]); forprime(p=1, m[#m], my(j=0); while(p^2^j<m[#m], setsearch(m, p^2^j)||n=concat(n, [p^2^j, 0]~); j++)); vector(#n=vecsort(n), i, 2^i)*n[2, ]~>>1} \\ M. F. Hasler, Apr 08 2015
(PARI)
up_to_e = 8192;
v050376 = vector(up_to_e);
ispow2(n) = (n && !bitand(n, n-1));
i = 0; for(n=1, oo, if(ispow2(isprimepower(n)), i++; v050376[i] = n); if(i == up_to_e, break));
A052331(n) = { my(s=0, e); while(n > 1, fordiv(n, d, if(((n/d)>1)&&ispow2(isprimepower(n/d)), e = vecsearch(v050376, n/d); if(!e, print("v050376 too short!"); return(1/0)); s += 2^(e-1); n = d; break))); (s); }; \\ Antti Karttunen, Apr 12 2018
CROSSREFS
KEYWORD
nonn
AUTHOR
Christian G. Bower, Dec 15 1999
STATUS
approved