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 38 results. Next

A110593 a(1) = 3, a(n+1) = 2*(3^n).

Original entry on oeis.org

3, 6, 18, 54, 162, 486, 1458, 4374, 13122, 39366, 118098, 354294, 1062882, 3188646, 9565938, 28697814, 86093442, 258280326, 774840978, 2324522934, 6973568802, 20920706406, 62762119218, 188286357654, 564859072962, 1694577218886
Offset: 1

Views

Author

Jonathan Vos Post, Jul 29 2005

Keywords

Comments

Same as A025192 for n > 1. - Georg Fischer, Oct 21 2018

Crossrefs

Programs

  • Mathematica
    Rest[CoefficientList[Series[3 x + 6 x^2/(1 - 3 x), {x, 0, 50}], x]] (* G. C. Greubel, Sep 01 2017 *)
    Join[{3},NestList[3#&,6,30]] (* Harvey P. Dale, Aug 14 2024 *)
  • PARI
    x='x+O('x^50); Vec(3*x + 6*x^2/(1-3*x)) \\ G. C. Greubel, Sep 01 2017

Formula

a(n) = A008776(n-1) for n>1. - R. J. Mathar, Apr 24 2007
G.f.: 3*x + 6*x^2/(1-3*x). - R. J. Mathar, Nov 18 2007

A330358 a(n) = n mod 5 + n mod 25 + ... + n mod 5^k, where 5^k <= n < 5^(k+1).

Original entry on oeis.org

0, 0, 0, 0, 0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 0, 2, 4, 6, 8, 5, 7, 9, 11, 13, 10, 12, 14, 16, 18, 15, 17, 19, 21, 23, 20, 22, 24, 26, 28, 0, 2, 4, 6, 8, 5, 7, 9, 11, 13, 10, 12, 14, 16, 18, 15, 17, 19, 21, 23, 20, 22, 24, 26, 28, 0, 2, 4, 6, 8, 5, 7, 9, 11, 13, 10
Offset: 1

Views

Author

Petros Hadjicostas, Dec 12 2019

Keywords

Comments

Conjecture: For b >= 2, consider the function s(n,b) = Sum_{1 <= b^j <= n} (n mod b^j) from p. 8 in Dearden et al. (2011). Then s(b*n + r, b) = b*s(n,b) + r*N(n,b) for 0 <= r <= b-1, where N(n,b) = floor(log_b(n)) + 1 is the number of digits in the base-b representation of n. As initial conditions, we have s(n,b) = 0 for 1 <= n <= b. (This is a generalization of a result by Robert Israel in A049802.)
Here b = 5 and a(n) = s(n,5).
We have N(n,2) = A070939(n), N(n,3) = A081604(n), N(n,4) = A110591(n), and N(n,5) = A110592(n).
If A_b(x) = Sum_{n >= 1} s(n,b)*x^n is the g.f. of the sequence (s(n,b): n >= 1) and the above conjecture is correct, then it can be proved that A_b(x) = b * A_b(x^b) * (1-x^b)/(1-x) + x * ((b-1)*x^b - b*x^(b-1) + 1)/((1-x)^2 * (1-x^b)) * Sum_{k >= 1} x^(b^k).

Crossrefs

Programs

  • Maple
    a:= n-> add(irem(n, 5^j), j=1..ilog[5](n)):
    seq(a(n), n=1..105);  # Alois P. Heinz, Dec 13 2019
  • Mathematica
    a[n_] := Sum[Mod[n, 5^j], {j, 1, Length[IntegerDigits[n, 5]] - 1}];
    Array[a, 105] (* Jean-François Alcover, Dec 31 2021 *)
  • PARI
    a(n) = sum(k=1, logint(n, 5), n % 5^k);
    for(n=1, 100, print1(a(n), ", ")); \\ (after Michel Marcus's program in A049804)

Formula

Conjecture: a(5*n+r) = 5*a(n) + r*A110592(n) = 5*a(n) + r*(floor(log_5(n)) + 1) for n >= 1 and r = 0, 1, 2, 3, 4.
If the conjecture above is true, the g.f. A(x) satisfies A(x) = 5*(1 + x + x^2 + x^3 + x^4)*A(x^5) + x*(1 + 2*x + 3*x^2 + 4*x^3)/(1 - x^5) * Sum_{k >= 1} x^(5^k).

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.

A343601 For any positive number n, the ternary representation of a(n) is obtained by right-rotating the ternary representation of n until a nonzero digit appears again as the leftmost digit; a(0) = 0.

Original entry on oeis.org

0, 1, 2, 3, 4, 7, 6, 5, 8, 9, 12, 21, 10, 13, 22, 19, 14, 23, 18, 15, 24, 11, 16, 25, 20, 17, 26, 27, 36, 63, 30, 37, 64, 57, 38, 65, 28, 39, 66, 31, 40, 67, 58, 41, 68, 55, 42, 69, 32, 43, 70, 59, 44, 71, 54, 45, 72, 33, 46, 73, 60, 47, 74, 29, 48, 75, 34, 49
Offset: 0

Author

Rémy Sigrist, Apr 21 2021

Keywords

Comments

This sequence is a permutation of the nonnegative integers with inverse A343600.

Examples

			The first terms, in base 10 and in base 3, are:
  n   a(n)  ter(n)  ter(a(n))
  --  ----  ------  ---------
   0     0       0          0
   1     1       1          1
   2     2       2          2
   3     3      10         10
   4     4      11         11
   5     7      12         21
   6     6      20         20
   7     5      21         12
   8     8      22         22
   9     9     100        100
  10    12     101        110
  11    21     102        210
  12    10     110        101
  13    13     111        111
  14    22     112        211
		

Crossrefs

Cf. A053735, A081604, A139706 (binary variant), A160384, A343600 (inverse).

Programs

  • PARI
    a(n, base=3) = { my (d=digits(n, base)); forstep (k=#d, 2, -1, if (d[k], return (fromdigits(concat(d[k..#d], d[1..k-1]), base)))); n }

Formula

A053735(a(n)) = A053735(n).
A081604(a(n)) = A081604(n).
a^k(n) = n for k = A160384(n) (where a^k denotes the k-th iterate of a).

A091093 In ternary representation: minimal number of editing steps (delete, insert or substitute) to transform n into n^2.

Original entry on oeis.org

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

Author

Reinhard Zumkeller, Dec 18 2003

Keywords

Examples

			a(12)=2: 12->'110', insert a 2 between the 1's and insert a 0 at the end: '12100'->144=12^2.
		

Crossrefs

Programs

  • Maple
    A091093:= proc(x) local L1, L2;
       L1:= convert(map(`+`,ListTools:-Reverse(convert(x,base,3)),48),bytes);
       L2:= convert(map(`+`,ListTools:-Reverse(convert(x^2,base,3)),48),bytes);
       StringTools:-Levenshtein(L1,L2)
    end proc:
    seq(A091093(i),i=0..1000); # Robert Israel, May 06 2014

Formula

a(n) = LevenshteinDistance(A007089(n), A001738(n)).

A138167 Numbers containing their length in ternary representation.

Original entry on oeis.org

1, 5, 6, 7, 8, 9, 10, 11, 12, 21, 31, 36, 37, 38, 39, 40, 41, 42, 43, 44, 49, 58, 66, 67, 68, 76, 86, 95, 96, 97, 98, 104, 113, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149
Offset: 1

Author

Reinhard Zumkeller, Mar 03 2008

Keywords

Examples

			42 ->'1120', length = 4 ->'11', therefore 42 is a term;
420 ->'120120', length = 6 ->'20', therefore 420 is a term.
		

Crossrefs

A276624 The infinite trunk of ternary beanstalk with reversed subsections.

Original entry on oeis.org

0, 2, 8, 4, 26, 20, 16, 12, 10, 80, 72, 68, 62, 56, 52, 46, 42, 38, 34, 30, 28, 242, 232, 224, 216, 212, 204, 198, 194, 188, 180, 176, 170, 164, 160, 152, 144, 140, 134, 126, 122, 116, 110, 106, 100, 96, 92, 88, 84, 82, 728, 716, 706, 698, 688, 680, 672, 664, 656, 648, 644, 634, 626, 618, 610, 602, 594, 590, 582, 576, 572
Offset: 0

Author

Antti Karttunen, Sep 11 2016

Keywords

Comments

See A276623.

Crossrefs

Programs

  • Scheme
    (definec (A276624 n) (cond ((zero? n) n) ((= n 1) 2) (else (let ((maybe_next (* 2 (A054861 (A276624 (- n 1)))))) (if (not (= 1 (A053735 (+ 1 maybe_next)))) maybe_next (+ -1 (A000244 (+ 1 (A081604 (+ 1 maybe_next))))))))))

Formula

a(0) = 0; a(1) = 2; for n > 1, if 2*A054861(a(n-1))+1 is not a power of 3, then a(n) = 2*A054861(a(n-1)), otherwise a(n) = A000244(1+A081604(1+2*A054861(a(n-1)))) - 1.

A343600 For any positive number n, the ternary representation of a(n) is obtained by left-rotating the ternary representation of n until a nonzero digit appears again as the leftmost digit; a(0) = 0.

Original entry on oeis.org

0, 1, 2, 3, 4, 7, 6, 5, 8, 9, 12, 21, 10, 13, 16, 19, 22, 25, 18, 15, 24, 11, 14, 17, 20, 23, 26, 27, 36, 63, 30, 39, 48, 57, 66, 75, 28, 31, 34, 37, 40, 43, 46, 49, 52, 55, 58, 61, 64, 67, 70, 73, 76, 79, 54, 45, 72, 33, 42, 51, 60, 69, 78, 29, 32, 35, 38, 41
Offset: 0

Author

Rémy Sigrist, Apr 21 2021

Keywords

Comments

This sequence is a permutation of the nonnegative integers with inverse A343601.

Examples

			The first terms, in base 10 and in base 3, are:
  n   a(n)  ter(n)  ter(a(n))
  --  ----  ------  ---------
   0     0       0          0
   1     1       1          1
   2     2       2          2
   3     3      10         10
   4     4      11         11
   5     7      12         21
   6     6      20         20
   7     5      21         12
   8     8      22         22
   9     9     100        100
  10    12     101        110
  11    21     102        210
  12    10     110        101
  13    13     111        111
  14    16     112        121
		

Crossrefs

Cf. A053735, A081604, A139708 (binary variant), A160384, A343601 (inverse).

Programs

  • PARI
    a(n, base=3) = { my (d=digits(n, base)); for (k=2, #d, if (d[k], return (fromdigits(concat(d[k..#d], d[1..k-1]), base)))); n }

Formula

A053735(a(n)) = A053735(n).
A081604(a(n)) = A081604(n).
a^k(n) = n for k = A160384(n) (where a^k denotes the k-th iterate of a).

A110595 a(1)=5. For n > 1, a(n) = 4*5^(n-1) = A005054(n).

Original entry on oeis.org

5, 20, 100, 500, 2500, 12500, 62500, 312500, 1562500, 7812500, 39062500, 195312500, 976562500, 4882812500, 24414062500, 122070312500, 610351562500, 3051757812500, 15258789062500, 76293945312500, 381469726562500
Offset: 1

Author

Jonathan Vos Post, Jul 29 2005

Keywords

Comments

a(n) is the number of n-digit integers that contain only even digits (A014263). - Bernard Schott, Nov 11 2022

Programs

  • Mathematica
    Join[{5},NestList[5#&,20,20]] (* Harvey P. Dale, Jun 19 2013 *)
    Rest[CoefficientList[Series[5 x (1 - x)/(1 - 5 x), {x,0,50}], x]] (* G. C. Greubel, Sep 01 2017 *)
  • PARI
    my(x='x+O('x^50)); Vec(5*x*(1-x)/(1-5*x)) \\ G. C. Greubel, Sep 01 2017

Formula

O.g.f.: 5*x*(1-x)/(1-5*x). - Better definition from R. J. Mathar, May 13 2008
Sum_{n>=1} 1/a(n) = 21/80. - Bernard Schott, Nov 11 2022

Extensions

Better definition from R. J. Mathar, May 13 2008
Incorrect comment removed by Michel Marcus, Nov 11 2022
Previous Showing 21-30 of 38 results. Next