A074940 Numbers having at least one 2 in their ternary representation.
2, 5, 6, 7, 8, 11, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 29, 32, 33, 34, 35, 38, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 83, 86, 87, 88, 89, 92
Offset: 1
Examples
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
Links
- Charles R Greathouse IV, Table of n, a(n) for n = 1..10000
- Emeric Deutsch and Bruce E. Sagan, Congruences for Catalan and Motzkin numbers and related sequences, arXiv:math/0407326 [math.CO], 2004.
- Emeric Deutsch and Bruce E. Sagan, Congruences for Catalan and Motzkin numbers and related sequences, J. Num. Theory 117 (2006), 191-215.
Crossrefs
Programs
-
Haskell
a074940 n = a074940_list !! (n-1) a074940_list = filter ((== 0) . a039966) [0..] -- Reinhard Zumkeller, Jun 06 2012, Sep 29 2011
-
Mathematica
Select[Range@ 120, MemberQ[IntegerDigits[#, 3], 2] &] (* or *) Select[Range@ 120, Divisible[Binomial[2 #, #], 3] &] (* Michael De Vlieger, Jun 29 2016 *) Select[Range[100],DigitCount[#,3,2]>0&] (* Harvey P. Dale, Aug 25 2019 *)
-
PARI
is(n)=while(n,if(n%3==2,return(1));n\=3);0 \\ Charles R Greathouse IV, Aug 21 2011
-
Python
from gmpy2 import digits def A074940(n): def f(x): s = digits(x,3) for i in range(l:=len(s)): if s[i]>'1': break else: return n+int(s,2) return n+int(s[:i]+'1'*(l-i),2) m, k = n, f(n) while m != k: m, k = k, f(k) return m # Chai Wah Wu, Oct 29 2024
Formula
a(n) = n + O(n^0.631). - Charles R Greathouse IV, Aug 21 2011
Extensions
More terms from Emeric Deutsch and Bruce E. Sagan, Dec 04 2003
Comments