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.

Previous Showing 21-30 of 41 results. Next

A132140 Numbers containing no zeros in ternary representation and with an initial 1.

Original entry on oeis.org

1, 4, 5, 13, 14, 16, 17, 40, 41, 43, 44, 49, 50, 52, 53, 121, 122, 124, 125, 130, 131, 133, 134, 148, 149, 151, 152, 157, 158, 160, 161, 364, 365, 367, 368, 373, 374, 376, 377, 391, 392, 394, 395, 400, 401, 403, 404, 445, 446, 448, 449, 454, 455, 457, 458, 472
Offset: 1

Views

Author

Reinhard Zumkeller, Aug 20 2007

Keywords

Comments

Intersection of A032924 and A132141;
A132138(A132139(a(n))) = 1.

Examples

			14 is in the sequence because its ternary representation is 112;
15 is not in the sequence because its ternary representation is 120.
		

Crossrefs

Programs

  • Haskell
    a132140 n = a132140_list !! (n-1)
    a132140_list = filter f [1..] where
       f x = x < 3 && x == 1 || t > 0 && f x' where (x', t) = divMod x 3
    -- Reinhard Zumkeller, Feb 06 2015
  • Maple
    a:=proc(n) local nn, L: nn:=convert(n,base,3): L:=nops(nn): if nn[L]=1 and 0 < product(nn[j],j=1..L) then n else end if end proc: seq(a(n),n=1..500); # Emeric Deutsch, Sep 09 2007
  • Mathematica
    Flatten[Table[FromDigits[Join[{1},#],3]&/@Tuples[{1,2},n],{n,0,5}]] (* Harvey P. Dale, Jan 28 2015 *)

A082555 Primes whose base-3 representation does not contain a 0.

Original entry on oeis.org

2, 5, 7, 13, 17, 23, 41, 43, 53, 67, 71, 79, 131, 149, 151, 157, 211, 229, 233, 239, 241, 367, 373, 401, 449, 457, 607, 617, 619, 643, 647, 691, 701, 719, 727, 1093, 1097, 1103, 1123, 1129, 1187, 1201, 1213, 1367, 1373, 1427, 1429, 1447, 1453, 1823, 1831, 1861
Offset: 1

Views

Author

Randy L. Ekl, May 03 2003

Keywords

Comments

Primes in A032924. - Robert Israel, Dec 28 2018
The analog "primes without digit 2 in ternary" is A077717. There is no prime > 2 not having the digit 1 in ternary, since then the number is divisible by 2. - M. F. Hasler, Feb 15 2023

Examples

			41 = 1112_3, which contains no 0.
		

Crossrefs

Cf. A032924 (numbers without digit 0 in base 3), A073779, A077267.
Cf. A077717 (primes that are the sum of distinct powers of 3 <=> base-3 representation does not contain a digit 2).

Programs

  • Maple
    select(t -> isprime(t) and not(has(convert(t,base,3),0)), [2,seq(i,i=5..10000,2)]); # Robert Israel, Dec 28 2018
  • PARI
    dec3(s)=while(s>0,if(s%3==0,return(0),s=floor(s/3))); return(1)
    forprime(i=1,20000,if(dec3(i)==1,print1(i,", "),))
    
  • Python
    def is_A082555(n): return is_A032924(n) and A010051(n)
    [p for p in range(1888) if is_A082555(p)] # M. F. Hasler, Feb 15 2023

A106370 Smallest b > 1 such that n contains no zeros in its base b representation.

Original entry on oeis.org

2, 3, 2, 3, 3, 4, 2, 3, 4, 4, 4, 5, 3, 3, 2, 3, 3, 5, 5, 6, 4, 3, 3, 5, 3, 3, 4, 6, 4, 4, 2, 5, 5, 5, 6, 5, 4, 4, 4, 3, 3, 4, 3, 3, 4, 4, 4, 5, 3, 3, 6, 3, 3, 4, 4, 5, 4, 4, 4, 7, 4, 4, 2, 5, 6, 5, 3, 3, 5, 3, 3, 5, 5, 5, 7, 3, 3, 7, 3, 3, 5, 5, 5, 5, 4, 4, 4, 5, 4, 4, 4, 5, 4, 4, 4, 5, 5, 5, 5, 6, 4, 4, 4, 6, 4
Offset: 1

Views

Author

Reinhard Zumkeller, May 01 2005

Keywords

Examples

			n = 20: 20[binary] = '101001', 20[ternary] = '202', 20[base-4] = '110', 20[base-5] = '40', all containing at least one zero, but: 20[base-6] = '32', containing no zero therefore a(20) = 6.
		

Crossrefs

Programs

  • Haskell
    a106370 n = f 2 n where
       f b x = g x where
         g 0 = b
         g z = if r == 0 then f (b + 1) n else g z'
               where (z', r) = divMod z b
    -- Reinhard Zumkeller, Apr 12 2015
  • Mathematica
    a[n_] := Module[{b = 2}, While[MemberQ[IntegerDigits[n, b], 0], b++]; b]; Array[a, 100] (* Amiram Eldar, Jul 29 2025 *)

Formula

a(n*a(n)+k) <= a(n) for 1 <= k < a(n).
a(A106372(n)) = n and a(m) <> n for m < A106372(n).
a(A000225(n)) = 2; a(A032924(n)) = 3 for n <> 5.

Extensions

Typo in comment fixed by Reinhard Zumkeller, Aug 06 2010

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

Original entry on oeis.org

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, 40, 40, 40, 40, 40, 40, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121
Offset: 0

Views

Author

Reinhard Zumkeller, May 20 2005

Keywords

Comments

a(n) is the greatest ternary repunit that is not greater than the n-th number with no 2 in ternary representation.

Examples

			k=1: A003462(1) = (3^1-1)/2 = 1, therefore a(1) = a(2^1) = 1;
k=2: A003462(2) = (3^2-1)/2 = 4, therefore a(2+1) = a(2+2) =
a(2+3) = a(2+2^2) = 4.
		

Crossrefs

Cf. A007089, A003462 (repunits in base 3), A000523 (number of digits in binary representation of n).

Programs

  • Mathematica
    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 *)
  • PARI
    apply( {A107680(n)=3^exponent(n+1)\2}, [0..66]) \\ M. F. Hasler, Jun 22 2020
    
  • Python
    def A107680(n): return 3**((n+1).bit_length()-1)-1>>1 # Chai Wah Wu, Nov 07 2024

Formula

A032924(n) = a(n) + A107681(n);
A081604(A107681(n)) <= A081604(a(n)) = A081604(A032924(n)) = A000523(n+1).
a(n) = A003462(A000523(n+1)).

Extensions

Corrected by T. D. Noe, Oct 25 2006
Extended to a(0) = 0 by M. F. Hasler, Jun 23 2020

A107681 Repeat(first 2^k numbers with no 2 in ternary representation) for k>0.

Original entry on oeis.org

0, 1, 0, 1, 3, 4, 0, 1, 3, 4, 9, 10, 12, 13, 0, 1, 3, 4, 9, 10, 12, 13, 27, 28, 30, 31, 36, 37, 39, 40, 0, 1, 3, 4, 9, 10, 12, 13, 27, 28, 30, 31, 36, 37, 39, 40, 81, 82, 84, 85, 90, 91, 93, 94, 108, 109, 111, 112, 117, 118, 120, 121, 0, 1, 3, 4, 9, 10, 12, 13, 27, 28, 30, 31, 36, 37
Offset: 1

Views

Author

Reinhard Zumkeller, May 20 2005

Keywords

Comments

let A032924(n) = Sum(d(i)*3^i: 0
then .... a(n) = Sum((d(i)-1)*3^i: 0<=i
A032924(n) = A107680(n) + a(n);
A081604 (a(n)) <= A081604(A107680(n)) = A081604(A032924(n)) = A000523(n+1).

Examples

			A032924(177) = A107680(177) + a(177),
....... 1420 = ....... 1093 + 327,
.. '1221121' = ... '1111111'+ '110010',
............ = . A003462(7) + A005836(51).
		

Programs

  • PARI
    a(n)= fromdigits(binary(n+1-1<Ruud H.G. van Tol, Nov 18 2024
    
  • Python
    def A107681(n): return int(bin(n+1)[3:],3) # Chai Wah Wu, May 06 2025

Formula

a(n) = A005836(A062050(n+1)).

Extensions

Data corrected by Ruud H.G. van Tol, Nov 18 2024.

A330166 Length of the longest run of 0's in the ternary expression of n.

Original entry on oeis.org

1, 0, 0, 1, 0, 0, 1, 0, 0, 2, 1, 1, 1, 0, 0, 1, 0, 0, 2, 1, 1, 1, 0, 0, 1, 0, 0, 3, 2, 2, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 0, 0, 1, 0, 0, 2, 1, 1, 1, 0, 0, 1, 0, 0, 3, 2, 2, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 0, 0, 1, 0, 0, 2, 1, 1, 1, 0, 0, 1, 0, 0, 4, 3, 3, 2, 2, 2, 2, 2, 2, 2
Offset: 0

Author

Joshua Oliver, Dec 04 2019

Keywords

Comments

All numbers appear in this sequence. The n-th power of 3 (A000244(n)) has n 0's in its ternary expression.
The longest run of zeros possible in this sequence is 2, as the last digit of the ternary expression of the integers cycles between 0, 1, and 2, meaning that at least one of three consecutive numbers has a 0 in its ternary expression.

Examples

			For n = 87, the ternary expression of 87 is 10020. The length of the runs of 0's in the ternary expression of 87 are 2 and 1, respectively. The larger of these two values is 2, so a(87) = 2.
   n [ternary n] a(n)
   0 [        0] 1
   1 [        1] 0
   2 [        2] 0
   3 [      1 0] 1
   4 [      1 1] 0
   5 [      1 2] 0
   6 [      2 0] 1
   7 [      2 1] 0
   8 [      2 2] 0
   9 [    1 0 0] 2
  10 [    1 0 1] 1
  11 [    1 0 2] 1
  12 [    1 1 0] 1
  13 [    1 1 1] 0
  14 [    1 1 2] 0
  15 [    1 2 0] 1
  16 [    1 2 1] 0
  17 [    1 2 2] 0
  18 [    2 0 0] 2
  19 [    2 0 1] 1
  20 [    2 0 2] 1
		

Crossrefs

Equals zero iff n is in A032924.

Programs

  • Mathematica
    Table[Max@FoldList[If[#2==0,#1+1,0]&,0,IntegerDigits[n,3]],{n,0,90}]

Formula

a(A000244(n)) = a(3^n) = n.
a(n) = 0 iff n is in A032924.

A360413 Irregular table T(n, k), n >= 0, k = 1..A002487(n+1), read by rows; the n-th row lists the numbers k such that A065361(k) = n.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 9, 7, 10, 8, 11, 12, 13, 14, 15, 18, 27, 16, 19, 28, 17, 20, 21, 29, 30, 22, 31, 23, 24, 32, 33, 36, 25, 34, 37, 26, 35, 38, 39, 40, 41, 42, 45, 54, 81, 43, 46, 55, 82, 44, 47, 48, 56, 57, 83, 84, 49, 58, 85, 50, 51, 59, 60, 63, 86, 87, 90
Offset: 0

Author

Rémy Sigrist, Feb 06 2023

Keywords

Comments

As a flat sequence, this is a permutation of the nonnegative integers with inverse A360414.

Examples

			Table T(n, k) begins:
  n   n-th row
  --  ------------------
   0  0
   1  1
   2  2, 3
   3  4
   4  5, 6, 9
   5  7, 10
   6  8, 11, 12
   7  13
   8  14, 15, 18, 27
   9  16, 19, 28
  10  17, 20, 21, 29, 30
  11  22, 31
  12  23, 24, 32, 33, 36
.
Table T(n, k) begins (with terms given in base 3):
  n   n-th row in base 3
  --  -------------------------
   0  0
   1  1
   2  2, 10
   3  11
   4  12, 20, 100
   5  21, 101
   6  22, 102, 110
   7  111
   8  112, 120, 200, 1000
   9  121, 201, 1001
  10  122, 202, 210, 1002, 1010
  11  211, 1011
  12  212, 220, 1012, 1020, 1100
		

Crossrefs

Programs

  • PARI
    See Links section.

Formula

T(n, 1) = A032924(n) for any n > 0.
T(n, A002487(n+1)) = A005836(n+1).
A065361(T(n, k)) = n.

A365278 In the binary expansion of n replace each run of k consecutive 1's by the decimal digits of A007931(k) to get the ternary expansion of a(n).

Original entry on oeis.org

0, 1, 3, 2, 9, 10, 6, 4, 27, 28, 30, 11, 18, 19, 12, 5, 81, 82, 84, 29, 90, 91, 33, 31, 54, 55, 57, 20, 36, 37, 15, 7, 243, 244, 246, 83, 252, 253, 87, 85, 270, 271, 273, 92, 99, 100, 93, 32, 162, 163, 165, 56, 171, 172, 60, 58, 108, 109, 111, 38, 45, 46, 21
Offset: 0

Author

Rémy Sigrist, Aug 30 2023

Keywords

Comments

This sequence is a permutation of the nonnegative integers with inverse A365279.
For any pair (b, c) of bases >= 2, we can devise a similar sequence, say F_{b, c}:
- for any d >= 2, let Z_d be the set of zeroless numbers in base d,
- in the base b expansion of n replace each run of consecutive nonzero digits (say corresponding to Z_b(k) for some k > 0) by the base c digits of Z_c(k) to get the base c expansion of F_{b, c}(n),
- F_{b, c} is a permutation of the nonnegative integers with inverse F_{c, b},
- F_{c, d} o F_{b, c} = F_{b, d} and F_{b, b} is the identity,
- in particular the present sequence corresponds to F_{2, 3} and its inverse to F_{3, 2}.

Examples

			The binary expansion of 415 is "110011111", A007931(2) = 2 and A007931(5) = 21, so the ternary expansion of a(415) is "20021", and a(415) = 169.
		

Crossrefs

Programs

  • Mathematica
    A007931[n_]:=Rest[IntegerDigits[n+1,2]]+1;
    A365278[n_]:=FromDigits[Flatten[Map[If[First[#]==1,A007931[Length[#]],#]&,Split[IntegerDigits[n,2]]]],3];
    Array[A365278,100,0] (* Paolo Xausa, Oct 17 2023 *)
  • PARI
    See Links section.

Formula

a(2*n) = 3*a(n).
a(2^k - 1) = A032924(k) for any k > 0.
A077267(a(n)) = A023416(n).

A191109 a(1)=1, and if x is a term then 3x-1 and 3x+2 are terms too.

Original entry on oeis.org

1, 2, 5, 8, 14, 17, 23, 26, 41, 44, 50, 53, 68, 71, 77, 80, 122, 125, 131, 134, 149, 152, 158, 161, 203, 206, 212, 215, 230, 233, 239, 242, 365, 368, 374, 377, 392, 395, 401, 404, 446, 449, 455, 458, 473, 476, 482, 485, 608, 611, 617, 620, 635, 638, 644, 647, 689, 692, 698, 701, 716, 719, 725, 728, 1094, 1097, 1103, 1106, 1121
Offset: 1

Author

Clark Kimberling, May 26 2011

Keywords

Comments

See discussions at A190803, A191106.
The positive integers in (1+A191109)/3 comprise A153775, a proper subsequence of A191109.
The positive integers in (-2+A191109)/3 comprise A032924, a proper subsequence of A191109.

Crossrefs

Programs

  • Mathematica
    h = 3; i = -1; j = 3; k = 2; f = 1;  g = 7;
    a = Union[Flatten[NestList[{h # + i, j # + k} &, f, g]]]  (* 191109 *)
    b = (a + 1)/3; c = (a - 2)/3; r = Range[1, 900];
    d = Intersection[b, r] (* A153775 *)
    e = Intersection[c, r] (* A032924 *)
    Nest[Flatten[{#,3#-1,3#+2}]&,1,10]//Union (* Harvey P. Dale, Apr 05 2020 *)

Extensions

Name edited by Michel Marcus, Jul 29 2021

A360415 a(n) is the greatest number k not yet in the sequence such that A065361(n) = A065361(k).

Original entry on oeis.org

0, 1, 3, 2, 4, 9, 6, 10, 12, 5, 7, 11, 8, 13, 27, 18, 28, 30, 15, 19, 29, 21, 31, 36, 33, 37, 39, 14, 16, 20, 17, 22, 32, 24, 34, 38, 23, 25, 35, 26, 40, 81, 54, 82, 84, 45, 55, 83, 57, 85, 90, 87, 91, 93, 42, 46, 56, 48, 58, 86, 63, 88, 92, 60, 64, 89, 66, 94
Offset: 0

Author

Rémy Sigrist, Feb 06 2023

Keywords

Comments

This sequence is a self-inverse permutation of the nonnegative integers.

Examples

			There are four numbers k such that A065361(k) = 8: 14, 15, 18, 27,
- so a(14) = 27,
     a(15) = 18,
     a(18) = 15,
     a(27) = 14.
		

Crossrefs

See A360434 for a similar sequence.

Programs

  • PARI
    See Links section.

Formula

a(A360413(n, k)) = A360413(n, A002487(n) + 1 - k).
a(A032924(n)) = A005836(n+1) for any n > 0.
a(A005836(n+1)) = A032924(n) for any n > 0.
Previous Showing 21-30 of 41 results. Next