cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A235342 Sum of exponents in the (unique) factorization of n as a ratio of p! terms, p prime.

Original entry on oeis.org

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

Views

Author

Alexander Riasanovsky, Jan 06 2014

Keywords

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.

Examples

			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!).
		

Crossrefs

Programs

  • 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()

Formula

a(1)=0; a(p!)=1, p prime; a(xy)=a(x)+a(y); (group homomorphism from Q^+ to Z).

Extensions

More terms from Antti Karttunen, Mar 28 2017