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.

A107680 Repeating k-th ternary repunit (A003462) 2^k times, k >= 0.

This page as a plain text file.
%I A107680 #16 Nov 07 2024 21:58:45
%S A107680 0,1,1,4,4,4,4,13,13,13,13,13,13,13,13,40,40,40,40,40,40,40,40,40,40,
%T A107680 40,40,40,40,40,40,121,121,121,121,121,121,121,121,121,121,121,121,
%U A107680 121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121,121
%N A107680 Repeating k-th ternary repunit (A003462) 2^k times, k >= 0.
%C A107680 a(n) is the greatest ternary repunit that is not greater than the n-th number with no 2 in ternary representation.
%F A107680 A032924(n) = a(n) + A107681(n);
%F A107680 A081604(A107681(n)) <= A081604(a(n)) = A081604(A032924(n)) = A000523(n+1).
%F A107680 a(n) = A003462(A000523(n+1)).
%e A107680 k=1: A003462(1) = (3^1-1)/2 = 1, therefore a(1) = a(2^1) = 1;
%e A107680 k=2: A003462(2) = (3^2-1)/2 = 4, therefore a(2+1) = a(2+2) =
%e A107680 a(2+3) = a(2+2^2) = 4.
%t A107680 With[{nn=5},Flatten[Table[#[[1]],{#[[2]]}]&/@Thread[{Table[FromDigits[ PadRight[{},n,1],3],{n,nn}],2^Range[nn]}]]] (* _Harvey P. Dale_, Jan 04 2013 *)
%o A107680 (PARI) apply( {A107680(n)=3^exponent(n+1)\2}, [0..66]) \\ _M. F. Hasler_, Jun 22 2020
%o A107680 (Python)
%o A107680 def A107680(n): return 3**((n+1).bit_length()-1)-1>>1 # _Chai Wah Wu_, Nov 07 2024
%Y A107680 Cf. A007089, A003462 (repunits in base 3), A000523 (number of digits in binary representation of n).
%K A107680 nonn
%O A107680 0,4
%A A107680 _Reinhard Zumkeller_, May 20 2005
%E A107680 Corrected by _T. D. Noe_, Oct 25 2006
%E A107680 Extended to a(0) = 0 by _M. F. Hasler_, Jun 23 2020