Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #27 Apr 02 2019 08:06:31
%S 6,3,15,21,66,78,1326,190,1035,435,465,17205,861,903,9870,5565,
%T 1567335,16836,20100,2556,2628,49770,55278,4005,42195,413595,47895,
%U 10100265,5995,1437360,32131,8646,1352190,19559385,54397665,1642578,12246,52975,501501,134940,336324807802305
%N Least triangular number t such that t = prime(n)*triangular(m) for some m>0, or 0 if no such t exists.
%C Conjecture: a(n) > 0.
%C a(n) = (x^2-1)/8 where x is the least odd solution > 1 of the Pell-like equation x^2 - prime(n)*y^2 = 1 - prime(n). - _Robert Israel_, Jan 08 2015
%H Robert Israel, <a href="/A225503/b225503.txt">Table of n, a(n) for n = 1..1000</a> (n = 1..200 from Zak Seidov).
%e See A225502.
%p F:= proc(n) local p, S,x,y, z, cands, s;
%p p:= ithprime(n);
%p S:= {isolve(x^2 - p*y^2 = 1-p)};
%p for z from 0 do
%p cands:= select(s -> (subs(s,x) > 1 and subs(s,x)::odd), simplify(eval(S,_Z1=z)));
%p if cands <> {} then
%p x:= min(map(subs,cands, x));
%p return((x^2-1)/8)
%p fi
%p od;
%p end proc:
%p map(F, [$1..100]); # _Robert Israel_, Jan 08 2015
%t a[n_] := Module[{p, x0, sol, x, y}, p = Prime[n]; x0 = Which[n == 1, 7, n == 2, 5, True, sol = Table[Solve[x > 1 && y > 1 && x^2 - p y^2 == 1 - p, {x, y}, Integers] /. C[1] -> c, {c, 0, 1}] // Simplify; Select[x /. Flatten[sol, 1], OddQ] // Min]; (x0^2 - 1)/8];
%t Array[a, 171] (* _Jean-François Alcover_, Apr 02 2019, after _Robert Israel_ *)
%o (C)
%o #include <stdio.h>
%o #define TOP 300
%o typedef unsigned long long U64;
%o U64 isTriangular(U64 a) {
%o U64 sr = 1ULL<<32, s, b, t;
%o if (a < (sr/2)*(sr+1)) sr>>=1;
%o while (a < sr*(sr+1)/2) sr>>=1;
%o for (b = sr>>1; b; b>>=1) {
%o s = sr+b;
%o if (s&1) t = s*((s+1)/2);
%o else t = (s/2)*(s+1);
%o if (t >= s && a >= t) sr = s;
%o }
%o return (sr*(sr+1)/2 == a);
%o }
%o int main() {
%o U64 i, j, k, m, tm, p, pp = 1, primes[TOP];
%o for (primes[0]=2, i = 3; pp < TOP; i+=2) {
%o for (p = 1; p < pp; ++p) if (i%primes[p]==0) break;
%o if (p==pp) {
%o primes[pp++] = i;
%o for (j=p=primes[pp-2], m=tm=1; ; j=k, m++, tm+=m) {
%o if ((k = p*tm) < j) k=0;
%o if (isTriangular(k)) break;
%o }
%o printf("%llu, ", k);
%o }
%o }
%o return 0;
%o }
%o (PARI) a(n) = {p = prime(n); k = 1; while (! ((t=k*(k+1)/2) && ((t % p) == 0) && ispolygonal(t/p, 3)), k++); t;} \\ _Michel Marcus_, Jan 08 2015
%Y Cf. A000217, A112456, A225502.
%K nonn
%O 1,1
%A _Alex Ratushnyak_, May 09 2013
%E a(171) from _Giovanni Resta_, Jun 19 2013