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”).

Triangular numbers and numbers which cannot be represented as a sum of two earlier members of the sequence.
6

%I #15 Sep 26 2022 06:17:12

%S 0,1,3,5,6,10,14,15,21,23,28,32,36,40,45,52,55,66,74,78,82,86,91,105,

%T 113,117,120,124,136,153,155,166,171,184,190,197,201,209,210,217,228,

%U 231,247,253,276,278,300,311,325,349,351,378,390,406,435,439,465,474,496,516,518

%N Triangular numbers and numbers which cannot be represented as a sum of two earlier members of the sequence.

%e 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.

%e 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.

%p isA000217 := proc(n) issqr(8*n+1) ; end proc:

%p 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;

%p 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:

%p seq(A176747(n),n=0..60) ; # _R. J. Mathar_, Nov 01 2010

%p # Alternative:

%p A176747_list := proc(upto) local P, k, issum, istri; P := [];

%p issum := k -> ormap(p -> member(k - p, P), P);

%p istri := k -> issqr(8*k + 1);

%p for k from 0 to upto do

%p if istri(k) or not issum(k) then P := [op(P), k] fi od;

%p P end: print(A176747_list(518)); # _Peter Luschny_, Jul 20 2022

%t A176747list[upto_] := Module[{P = {}, issum, istri},

%t issum[k_] := AnyTrue[P, MemberQ[P, k-#]&];

%t istri[k_] := IntegerQ@Sqrt[8k+1];

%t For[k = 0, k <= upto, k++,

%t If[istri[k] || !issum[k], AppendTo[P, k]]];

%t P];

%t A176747list[518] (* _Jean-François Alcover_, Sep 26 2022, after _Peter Luschny_ *)

%Y Cf. A000217, A176744, A176745, A176746.

%K nonn

%O 0,3

%A _Vladimir Shevelev_, Apr 25 2010

%E Definition rephrased, sequence extended beyond 55 by _R. J. Mathar_, Nov 01 2010