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.

A225503 Least triangular number t such that t = prime(n)*triangular(m) for some m>0, or 0 if no such t exists.

Original entry on oeis.org

6, 3, 15, 21, 66, 78, 1326, 190, 1035, 435, 465, 17205, 861, 903, 9870, 5565, 1567335, 16836, 20100, 2556, 2628, 49770, 55278, 4005, 42195, 413595, 47895, 10100265, 5995, 1437360, 32131, 8646, 1352190, 19559385, 54397665, 1642578, 12246, 52975, 501501, 134940, 336324807802305
Offset: 1

Views

Author

Alex Ratushnyak, May 09 2013

Keywords

Comments

Conjecture: a(n) > 0.
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

Examples

			See A225502.
		

Crossrefs

Programs

  • C
    #include 
    #define TOP 300
    typedef unsigned long long U64;
    U64 isTriangular(U64 a) {
        U64 sr = 1ULL<<32, s, b, t;
        if (a < (sr/2)*(sr+1))  sr>>=1;
        while (a < sr*(sr+1)/2)  sr>>=1;
        for (b = sr>>1; b; b>>=1) {
            s = sr+b;
            if (s&1) t = s*((s+1)/2);
            else     t = (s/2)*(s+1);
            if (t >= s && a >= t)  sr = s;
        }
        return (sr*(sr+1)/2 == a);
    }
    int main() {
      U64 i, j, k, m, tm, p, pp = 1, primes[TOP];
      for (primes[0]=2, i = 3; pp < TOP; i+=2) {
        for (p = 1; p < pp; ++p) if (i%primes[p]==0) break;
        if (p==pp) {
            primes[pp++] = i;
            for (j=p=primes[pp-2], m=tm=1; ; j=k, m++, tm+=m) {
               if ((k = p*tm) < j) k=0;
               if (isTriangular(k)) break;
            }
            printf("%llu, ", k);
        }
      }
      return 0;
    }
    
  • Maple
    F:= proc(n) local p, S,x,y, z, cands, s;
          p:= ithprime(n);
          S:= {isolve(x^2 - p*y^2 = 1-p)};
          for z from 0 do
            cands:= select(s -> (subs(s,x) > 1 and subs(s,x)::odd), simplify(eval(S,_Z1=z)));
            if cands <> {} then
               x:= min(map(subs,cands, x));
               return((x^2-1)/8)
            fi
          od;
    end proc:
    map(F, [$1..100]); # Robert Israel, Jan 08 2015
  • Mathematica
    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];
    Array[a, 171] (* Jean-François Alcover, Apr 02 2019, after Robert Israel *)
  • 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

Extensions

a(171) from Giovanni Resta, Jun 19 2013