login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A224362 Number of partitions of n into a prime and a triangular number. 1
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 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,4
COMMENTS
Indices of zeros: 0 followed by A076768.
LINKS
FORMULA
G.f.: (Sum_{i>=0} x^(i*(i+1)/2))*(Sum_{j>=1} x^prime(j)). - Ilya Gutkovskiy, Feb 07 2017
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 *)
PROG
(Python)
import math
primes = [2]*2
primes[1] = 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(1L<<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 str(k)+', ',
CROSSREFS
Sequence in context: A263643 A336534 A271852 * A350560 A050362 A095686
KEYWORD
nonn
AUTHOR
Alex Ratushnyak, Apr 04 2013
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 19 08:45 EDT 2024. Contains 371782 sequences. (Running on oeis4.)