login
Numbers not of the form m*(m+1)*(m+2)/6, the non-tetrahedral numbers.
7

%I #32 Jan 05 2025 19:51:38

%S 2,3,5,6,7,8,9,11,12,13,14,15,16,17,18,19,21,22,23,24,25,26,27,28,29,

%T 30,31,32,33,34,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,

%U 54,55,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78

%N Numbers not of the form m*(m+1)*(m+2)/6, the non-tetrahedral numbers.

%C Complement of A000292; A000040 is a subsequence.

%H G. C. Greubel, <a href="/A145397/b145397.txt">Table of n, a(n) for n = 1..5000</a>

%H Cristinel Mortici, <a href="https://web.archive.org/web/2024*/https://www.fq.math.ca/Papers1/48-4/Mortici.pdf">Remarks on Complementary Sequences</a>, Fibonacci Quart. 48 (2010), no. 4, 343-347.

%F A014306(a(n)) = 1; A023533(a(n)) = 0.

%F a(n) = n+m if 6(n+m)>m(m+1)(m+2) and a(n)=n+m-1 otherwise where m is floor((6n)^(1/3)). - _Chai Wah Wu_, Oct 01 2024

%t Select[Range[100], Binomial[Floor[Surd[6*# -1, 3]] +2, 3] != # &] (* _G. C. Greubel_, Feb 20 2022 *)

%o (PARI) is(n)=binomial(sqrtnint(6*n,3)+2,3)!=n \\ _Charles R Greathouse IV_, Feb 22 2017

%o (Magma) [n: n in [1..100] | Binomial(Floor((6*n-1)^(1/3))+2, 3) ne n ]; // _G. C. Greubel_, Feb 20 2022

%o (Sage) [n for n in (1..100) if binomial( floor( real_nth_root(6*n-1, 3) ) +2, 3) != n ] # _G. C. Greubel_, Feb 20 2022

%o (Python)

%o from itertools import count

%o from math import comb

%o from sympy import integer_nthroot

%o def A145397(n):

%o def f(x): return n+next(i for i in count(integer_nthroot(6*x,3)[0],-1) if comb(i+2,3)<=x)

%o def iterfun(f,n=0):

%o m, k = n, f(n)

%o while m != k: m, k = k, f(k)

%o return m

%o return iterfun(f,n) # _Chai Wah Wu_, Sep 09 2024

%o (Python)

%o from math import comb

%o from sympy import integer_nthroot

%o def A145397(n): return n+(m:=integer_nthroot(6*n,3)[0])-(n+m<=comb(m+2,3)) # _Chai Wah Wu_, Oct 01 2024

%Y Cf. A000040, A000292, A014306, A023533.

%K nonn

%O 1,1

%A _Reinhard Zumkeller_, Oct 14 2008

%E Definition corrected by _Ant King_, Sep 20 2012