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.
%I A224362 #17 Nov 14 2024 10:58:08 %S A224362 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, %T A224362 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, %U A224362 6,3,1,4,2,4,6,1,3,4,1,4,3,3,4,5,2,3,4 %N A224362 Number of partitions of n into a prime and a triangular number. %C A224362 Indices of zeros: 0 followed by A076768. %H A224362 T. D. Noe, <a href="/A224362/b224362.txt">Table of n, a(n) for n = 0..10000</a> %F A224362 G.f.: (Sum_{i>=0} x^(i*(i+1)/2))*(Sum_{j>=1} x^prime(j)). - _Ilya Gutkovskiy_, Feb 07 2017 %t A224362 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 *) %o A224362 (Python) %o A224362 import math %o A224362 primes = [2, 3] %o A224362 def isprime(k): %o A224362 for p in primes: %o A224362 if k%p==0: return 0 %o A224362 primes.append(k) %o A224362 return 1 %o A224362 def rootTriangular(a): %o A224362 sr = 2**(int(math.log(a,2))+2) %o A224362 while a < sr*(sr+1)//2: %o A224362 sr>>=1 %o A224362 b = sr>>1 %o A224362 while b: %o A224362 s = sr+b %o A224362 if a >= s*(s+1)//2: %o A224362 sr = s %o A224362 b>>=1 %o A224362 return sr %o A224362 for i in range(1<<10): %o A224362 k = 0 %o A224362 for p in primes: %o A224362 if i <= p: continue %o A224362 r = rootTriangular(i - p) %o A224362 if r*(r+1)//2 == i-p: k+=1 %o A224362 if i>1: %o A224362 if i<=3: k += 1 %o A224362 else: k += isprime(i) %o A224362 print(k, end=', ') %Y A224362 Cf. A000040, A000217, A076768, A101182. %K A224362 nonn %O A224362 0,4 %A A224362 _Alex Ratushnyak_, Apr 04 2013