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.

Showing 1-1 of 1 results.

A224362 Number of partitions of n into a prime and a triangular number.

Original entry on oeis.org

0, 0, 1, 2, 1, 2, 2, 1, 3, 1, 1, 2, 2, 3, 2, 1, 1, 4, 2, 2, 3, 1, 2, 4, 2, 1, 3, 1, 2, 3, 2, 2, 4, 2, 3, 2, 0, 2, 4, 3, 2, 4, 1, 3, 4, 1, 2, 6, 2, 2, 3, 2, 3, 4, 1, 1, 3, 3, 4, 4, 2, 1, 6, 1, 3, 3, 1, 3, 6, 3, 1, 4, 2, 4, 6, 1, 3, 4, 1, 4, 3, 3, 4, 5, 2, 3, 4
Offset: 0

Views

Author

Alex Ratushnyak, Apr 04 2013

Keywords

Comments

Indices of zeros: 0 followed by A076768.

Crossrefs

Programs

  • Mathematica
    nn = 13; tri = Table[n*(n + 1)/2, {n, 0, nn}]; pr = Prime[Range[PrimePi[tri[[-1]]]]]; Table[Length[Intersection[pr, n - tri]], {n, 0, tri[[-1]]}] (* T. D. Noe, Apr 05 2013 *)
  • Python
    import math
    primes = [2, 3]
    def isprime(k):
      for p in primes:
        if k%p==0:  return 0
      primes.append(k)
      return 1
    def rootTriangular(a):
        sr = 2**(int(math.log(a,2))+2)
        while a < sr*(sr+1)//2:
              sr>>=1
        b = sr>>1
        while b:
          s = sr+b
          if a >= s*(s+1)//2:
            sr = s
          b>>=1
        return sr
    for i in range(1<<10):
        k = 0
        for p in primes:
          if i <= p:  continue
          r = rootTriangular(i - p)
          if r*(r+1)//2 == i-p:  k+=1
        if i>1:
          if i<=3:  k += 1
          else:     k += isprime(i)
        print(k, end=', ')

Formula

G.f.: (Sum_{i>=0} x^(i*(i+1)/2))*(Sum_{j>=1} x^prime(j)). - Ilya Gutkovskiy, Feb 07 2017
Showing 1-1 of 1 results.