login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A176747
Triangular numbers and numbers which cannot be represented as a sum of two earlier members of the sequence.
6
0, 1, 3, 5, 6, 10, 14, 15, 21, 23, 28, 32, 36, 40, 45, 52, 55, 66, 74, 78, 82, 86, 91, 105, 113, 117, 120, 124, 136, 153, 155, 166, 171, 184, 190, 197, 201, 209, 210, 217, 228, 231, 247, 253, 276, 278, 300, 311, 325, 349, 351, 378, 390, 406, 435, 439, 465, 474, 496, 516, 518
OFFSET
0,3
EXAMPLE
5 is the smallest number which is not represented as sum of 2 numbers of the set {0,1,3}. Therefore 5 is in the sequence.
14 is the smallest number which is not represented as sum of 2 numbers of the set {0,1,3,5,6,10}. Therefore 14 is in the sequence.
MAPLE
isA000217 := proc(n) issqr(8*n+1) ; end proc:
A176747 := proc(n) option remember; if n <=1 then n; else for a from procname(n-1)+1 do if isA000217(a) then return a; end if;
isrep := false; for i from 1 to n-1 do for j from i to n-1 do if procname(i)+procname(j) = a then isrep := true; end if; end do: end do: if not isrep then return a; end if; end do: end if; end proc:
seq(A176747(n), n=0..60) ; # R. J. Mathar, Nov 01 2010
# Alternative:
A176747_list := proc(upto) local P, k, issum, istri; P := [];
issum := k -> ormap(p -> member(k - p, P), P);
istri := k -> issqr(8*k + 1);
for k from 0 to upto do
if istri(k) or not issum(k) then P := [op(P), k] fi od;
P end: print(A176747_list(518)); # Peter Luschny, Jul 20 2022
MATHEMATICA
A176747list[upto_] := Module[{P = {}, issum, istri},
issum[k_] := AnyTrue[P, MemberQ[P, k-#]&];
istri[k_] := IntegerQ@Sqrt[8k+1];
For[k = 0, k <= upto, k++,
If[istri[k] || !issum[k], AppendTo[P, k]]];
P];
A176747list[518] (* Jean-François Alcover, Sep 26 2022, after Peter Luschny *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Vladimir Shevelev, Apr 25 2010
EXTENSIONS
Definition rephrased, sequence extended beyond 55 by R. J. Mathar, Nov 01 2010
STATUS
approved