login
Complement of generalized pentagonal numbers (A001318).
24

%I #37 Sep 15 2024 06:50:17

%S 3,4,6,8,9,10,11,13,14,16,17,18,19,20,21,23,24,25,27,28,29,30,31,32,

%T 33,34,36,37,38,39,41,42,43,44,45,46,47,48,49,50,52,53,54,55,56,58,59,

%U 60,61,62,63,64,65,66,67,68,69,71,72,73,74,75,76,78,79,80,81,82,83,84

%N Complement of generalized pentagonal numbers (A001318).

%C Also n for which A006906(n) is even, or equivalently n for which A000009(n) is even (since A006906 and A000009 have the same parity).

%C The number of partitions of a(n) into distinct parts with an even number of parts equals the number of such partitions with an odd number of parts: A067661(a(n)) = A067659(a(n)). See, e.g., the Freitag-Busam reference, p. 410 given in A036499. - _Wolfdieter Lang_, Jan 19 2016

%H G. C. Greubel, <a href="/A090864/b090864.txt">Table of n, a(n) for n = 1..1000</a>

%F A080995(a(n)) = 0; A000009(a(n)) = A118303(n). - _Reinhard Zumkeller_, Apr 22 2006

%F A010815(a(n)) = A067661(a(n)) - A067659(a(n)) = 0, n >= 1. See a comment above. - _Wolfdieter Lang_, Jan 19 2016

%F a(n) = n+1 + A085141(n-1) + A111651(n). - _Kevin Ryde_, Sep 15 2024

%t Complement[Range[200], Select[Accumulate[Range[0,200]]/3, IntegerQ]] (* _G. C. Greubel_, Jun 06 2017 *)

%o (Python)

%o from math import isqrt

%o def A090864(n):

%o def f(x): return n+(m:=isqrt(24*x+1)+1)//6+(m-2)//6

%o kmin, kmax = 0,1

%o while f(kmax) > kmax:

%o kmax <<= 1

%o while kmax-kmin > 1:

%o kmid = kmax+kmin>>1

%o if f(kmid) <= kmid:

%o kmax = kmid

%o else:

%o kmin = kmid

%o return kmax # _Chai Wah Wu_, Aug 29 2024

%o (PARI) a(n) = my(q,r); [q,r]=divrem(sqrtint(24*n),3); n + q + (r >= bitnegimply(1,q)); \\ _Kevin Ryde_, Sep 15 2024

%Y Cf. A000009, A001318, A067659, A067661, A080995, A006906, A010815, A118303.

%Y Cf. A085141, A111651.

%K nonn,easy

%O 1,1

%A _Jon Perry_, Feb 12 2004

%E More terms from _Reinhard Zumkeller_, Apr 22 2006

%E Edited by _Ray Chandler_, Dec 14 2011

%E Edited by _Jon E. Schoenfield_, Nov 25 2016