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.

A113042 Number of solutions to +-p(1)+-p(2)+-...+-p(2n) = 3 where p(i) is the i-th prime.

Original entry on oeis.org

0, 2, 1, 7, 15, 45, 139, 438, 1419, 4703, 16019, 55146, 190254, 671215, 2404179, 8534995, 30635448, 110495549, 401418693, 1467388464, 5393131894, 19883104535, 73856058401, 273600682457, 1017557492609, 3803885439979, 14266466901249, 53564801078049
Offset: 1

Views

Author

Floor van Lamoen, Oct 12 2005

Keywords

Comments

+-p(1)+-p(2)+-...+-p(2n+1) = 3 does not have solutions, since the left hand side is even. [Corrected and edited by M. F. Hasler, Aug 09 2015]

Crossrefs

Cf. A022894 - A022904, A022920, A083309; A261061 - A261063 and A261045 (r.h.s. = -1); A261057, A261059, A261060 and A261044 (r.h.s. = -2); A113040, A113041.

Programs

  • Maple
    A113042:=proc(n) local i,j,p,t; t:= NULL; for j from 2 to 2*n by 2 do p:=1; for i to j do p:=p*(x^(-ithprime(i))+x^(ithprime(i))); od; t:=t,coeff(p,x,3); od; t; end;
    # second Maple program
    sp:= proc(n) sp(n):= `if`(n=0, 0, ithprime(n)+sp(n-1)) end:
    b := proc(n, i) option remember; `if`(n>sp(i), 0, `if`(i=0, 1,
            b(n+ithprime(i), i-1)+ b(abs(n-ithprime(i)), i-1)))
         end:
    a:= n-> b(3, 2*n):
    seq(a(n), n=1..30);  # Alois P. Heinz, Aug 05 2012
  • Mathematica
    sp[n_] := sp[n] = If[n == 0, 0, Prime[n] + sp[n-1]]; b[n_, i_] := b[n, i] = If[n>sp[i], 0, If[i == 0, 1, b[n + Prime[i], i-1] + b[Abs[n - Prime[i]], i-1]]]; a[n_] := b[3, 2*n]; Table[a[n], {n, 1, 30}] (* Jean-François Alcover, Jan 31 2017, after Alois P. Heinz *)

Formula

a(n) = [x^3] Product_{k=1..2*n} (x^prime(k) + 1/x^prime(k)). - Ilya Gutkovskiy, Jan 30 2024