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.

A074940 Numbers having at least one 2 in their ternary representation.

This page as a plain text file.
%I A074940 #54 Oct 29 2024 12:24:38
%S A074940 2,5,6,7,8,11,14,15,16,17,18,19,20,21,22,23,24,25,26,29,32,33,34,35,
%T A074940 38,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,
%U A074940 63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,83,86,87,88,89,92
%N A074940 Numbers having at least one 2 in their ternary representation.
%C A074940 Also, numbers m such that 3 divides C(2m,m).
%C A074940 Also, numbers m such that the central trinomial coefficient A002426(m) == 0 (mod 3). - _Emeric Deutsch_ and _Bruce E. Sagan_, Dec 04 2003
%C A074940 Also, numbers m such that A092255(m) == 0 (mod 3). - _Benoit Cloitre_, Mar 22 2004
%C A074940 Also, numbers m such that the coefficient of x^m equals 0 in Product_{k>=0} (1-x^(3^k)). - _N. J. A. Sloane_, Jun 01 2010
%H A074940 Charles R Greathouse IV, <a href="/A074940/b074940.txt">Table of n, a(n) for n = 1..10000</a>
%H A074940 Emeric Deutsch and Bruce E. Sagan, <a href="http://arxiv.org/abs/math.CO/0407326">Congruences for Catalan and Motzkin numbers and related sequences</a>, arXiv:math/0407326 [math.CO], 2004.
%H A074940 Emeric Deutsch and Bruce E. Sagan, <a href="http://dx.doi.org/10.1016/j.jnt.2005.06.005">Congruences for Catalan and Motzkin numbers and related sequences</a>, J. Num. Theory 117 (2006), 191-215.
%F A074940 a(n) = n + O(n^0.631). - _Charles R Greathouse IV_, Aug 21 2011
%e A074940 12 is not in the sequence since it is 110_3, but 11 is in the sequence since it is 102_3. - _Michael B. Porter_, Jun 30 2016
%t A074940 Select[Range@ 120, MemberQ[IntegerDigits[#, 3], 2] &] (* or *)
%t A074940 Select[Range@ 120, Divisible[Binomial[2 #, #], 3] &] (* _Michael De Vlieger_, Jun 29 2016 *)
%t A074940 Select[Range[100],DigitCount[#,3,2]>0&] (* _Harvey P. Dale_, Aug 25 2019 *)
%o A074940 (PARI) is(n)=while(n,if(n%3==2,return(1));n\=3);0 \\ _Charles R Greathouse IV_, Aug 21 2011
%o A074940 (Haskell)
%o A074940 a074940 n = a074940_list !! (n-1)
%o A074940 a074940_list = filter ((== 0) . a039966) [0..]
%o A074940 -- _Reinhard Zumkeller_, Jun 06 2012, Sep 29 2011
%o A074940 (Python)
%o A074940 from gmpy2 import digits
%o A074940 def A074940(n):
%o A074940     def f(x):
%o A074940         s = digits(x,3)
%o A074940         for i in range(l:=len(s)):
%o A074940             if s[i]>'1':
%o A074940                 break
%o A074940         else:
%o A074940             return n+int(s,2)
%o A074940         return n+int(s[:i]+'1'*(l-i),2)
%o A074940     m, k = n, f(n)
%o A074940     while m != k: m, k = k, f(k)
%o A074940     return m # _Chai Wah Wu_, Oct 29 2024
%Y A074940 Complement of A005836.
%Y A074940 Cf. A006996, A007089, A081603, A081610, A081605, A081606.
%Y A074940 A039966(a(n)) = 0.
%K A074940 easy,nonn
%O A074940 1,1
%A A074940 _Benoit Cloitre_ and _Reinhard Zumkeller_, Oct 04 2002; revised Dec 03 2003
%E A074940 More terms from _Emeric Deutsch_ and _Bruce E. Sagan_, Dec 04 2003