login
A235342
Sum of exponents in the (unique) factorization of n as a ratio of p! terms, p prime.
2
0, 1, 0, 2, -2, 1, -1, 3, 0, -1, -2, 2, -2, 0, -2, 4, -2, 1, -1, 0, -1, -1, 2, 3, -4, -1, 0, 1, 1, -1, 1, 5, -2, -1, -3, 2, -1, 0, -2, 1, 1, 0, 0, 0, -2, 3, -1, 4, -2, -3, -2, 0, 3, 1, -4, 2, -1, 2, 0, 0, 0, 2, -1, 6, -4, -1, -2, 0, 2, -2, 0, 3, -3, 0, -4, 1, -3, -1, 7, 2, 0, 2, -4, 1, -4, 1, 1, 1, 0, -1, -3, 4, 1, 0, -3, 5, -3, -1, -2, -2, 5, -1, 1
OFFSET
1,4
COMMENTS
With n > 0, write n = p_1!p_2!...p_k!/(q_1!q2!...q_l!) where p_i,q_j are primes and the fraction is simplified (i.e., no p_i is a q_j). This representation is unique for positive integers (and positive rational numbers), so we let a(n):=#p_i! terms on top-#q_j! terms on bottom.
LINKS
Seventieth Annual William Lowell Putnam Mathematical Competition, Problem B1, (2009).
FORMULA
a(1)=0; a(p!)=1, p prime; a(xy)=a(x)+a(y); (group homomorphism from Q^+ to Z).
EXAMPLE
a(1)=0 (by convention).
a(2)=1 since 2=2!.
a(3)=0 since 3=3!/2!.
a(4)=2 since 4=2!*2!.
a(5)=-2 since 5=5!/(3!*2!*2!).
PROG
(Sage)
def plus(c, d, mult):
for elt in d:
if elt in c:
c[elt]+=mult*d[elt]
else:
c[elt]=mult*d[elt]
def rep(m):
if m==1:
return {}
if m==2:
return {2:1}
f=factor(Integer(m))
#print f
if len(f)==1 and f[0][1]==1:
#print "prime", m
p=prime_range(m)[-1]
new={m:1, p:-1}
r=range(p+1, m)
#print "range", r
for k in r:
plus(new, rep(k), -1)
else:
new={}
#print "not prime", m, f
for (p, mult) in f:
#print (p, mult)
plus(new, rep(p), mult)
for elt in [elt for elt in new if new[elt]==0]:
new.pop(elt)
return new
def weight(m):
w=0
r=rep(m)
for p in r:
w+=r[p]
return w
A235342=[weight(m) for m in range(1, 5041)]
# Above code "de-periodicized" by Antti Karttunen, Mar 28 2017
# This is just for outputting a b-file:
i=0
outfp = open('b235342.txt', 'w')
for an in A235342:
i = i+1
outfp.write(str(i) + " " + str(an) + "\n")
outfp.close()
CROSSREFS
Sequence in context: A244006 A110283 A226290 * A079692 A110269 A238280
KEYWORD
sign
AUTHOR
EXTENSIONS
More terms from Antti Karttunen, Mar 28 2017
STATUS
approved