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 31-40 of 42 results. Next

A114482 Let S(1)=1, S(2)=10; S(2n)=concatenation of S(2n-1), S(2n-2) and 0; and S(2n+1)=concatenation of S(2n), S(2n) and 0. Sequence gives S(infinity).

Original entry on oeis.org

1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0
Offset: 1

Views

Author

Leroy Quet, Nov 30 2005

Keywords

Comments

Number of terms in S(n) is A062318(n).
Interpreting S(n) in binary and converting to decimal gives 1,2,20,164,84296,43159880,5792821120672400,...,.

Examples

			S(3) = {1,0,1,0,0}, S(4) = {1,0,1,0,0,1,0,0}, S(5) = {1,0,1,0,0,1,0,0,1,0,1,0,0,1,0,0,0}, ...
		

Crossrefs

Programs

  • Mathematica
    a[1] = {1}; a[2] = {1, 0}; a[n_] := a[n] = If[EvenQ[n], Join[a[n - 1], a[n - 2], {0}] // Flatten, Join[a[n - 1], a[n - 1], {0}] // Flatten]; a[8] (* Robert G. Wilson v *)

Extensions

More terms from Robert G. Wilson v, Jan 01 2006
Edited by N. J. A. Sloane, Jan 03 2006

A138002 a(3*n)=2*n, a(3*n+1)=a(n)+n, a(3*n+2)=2*a(n), a(n)=0 for n<3.

Original entry on oeis.org

0, 0, 0, 2, 1, 0, 4, 2, 0, 6, 5, 4, 8, 5, 2, 10, 5, 0, 12, 10, 8, 14, 9, 4, 16, 8, 0, 18, 15, 12, 20, 15, 10, 22, 15, 8, 24, 20, 16, 26, 18, 10, 28, 16, 4, 30, 25, 20, 32, 21, 10, 34, 17, 0, 36, 30, 24, 38, 29, 20, 40, 28, 16, 42, 35, 28, 44, 31, 18, 46, 27, 8, 48, 40, 32, 50, 33, 16, 52
Offset: 0

Views

Author

Reinhard Zumkeller, Feb 26 2008

Keywords

Crossrefs

Cf. A025480.

Programs

  • Mathematica
    a[0]=0;a[n_]:=Mod[n,3]*a[Floor[n/3]]+(2-Mod[n,3])*Floor[n/3];Array[a,79,0] (* James C. McMahon, Jun 05 2025 *)

Formula

a(n) = (n mod 3) * a(floor(n/3)) + (2 - n mod 3) * floor(n/3), a(n) = 0.
a(A062318(n)) = 0.

A319021 Next larger integer with same sum of digits in base 3 as n.

Original entry on oeis.org

3, 4, 9, 6, 7, 10, 11, 14, 27, 12, 13, 18, 15, 16, 19, 20, 23, 28, 21, 22, 29, 24, 25, 32, 35, 44, 81, 30, 31, 36, 33, 34, 37, 38, 41, 54, 39, 40, 45, 42, 43, 46, 47, 50, 55, 48, 49, 56, 51, 52, 59, 62, 71, 82, 57, 58, 63, 60, 61, 64, 65, 68, 83, 66, 67, 72
Offset: 1

Views

Author

Rémy Sigrist, Sep 08 2018

Keywords

Comments

This sequence is the base-3 variant of A057168 (base-2) and of A228915 (base-10).
All integers except those in A062318 appear in this sequence.

Examples

			The first terms, alongside the ternary representations of n and of a(n), are:
  n   a(n)  ter(n)  ter(a(n))
  --  ----  ------  ---------
   1     3      1     10
   2     4      2     11
   3     9     10    100
   4     6     11     20
   5     7     12     21
   6    10     20    101
   7    11     21    102
   8    14     22    112
   9    27    100   1000
  10    12    101    110
  11    13    102    111
  12    18    110    200
  13    15    111    120
  14    16    112    121
  15    19    120    201
		

Crossrefs

Programs

  • Mathematica
    nli3[n_]:=Module[{nd3=Total[IntegerDigits[n,3]],k=n+1},While[Total[IntegerDigits[k,3]]!=nd3,k++];k]; Array[nli3,70] (* Harvey P. Dale, Jun 27 2023 *)
  • PARI
    a(n, base=3) = my (c=0); for (w=0, oo, my (d=n % base); if (d+1 < base && c, return ((n+1)*base^w + ((c-1)%(base-1) + 1)*base^((c-1)\(base-1))-1), c += d; n \= base))
    
  • Python
    def a(n, base=3):
        c, b, w = 0, base, 0
        while True:
            d = n%b
            if d+1 < b and c:
                return (n+1)*b**w + ((c-1)%(b-1)+1)*b**((c-1)//(b-1))-1
            c += d; n //= b; w += 1
    print([a(n) for n in range(1, 67)]) # Michael S. Branicky, Jul 10 2022 after Rémy Sigrist

Formula

a(3^k) = 3^(k+1) for any k >= 0.
A053735(a(n)) = A053735(n).

A331789 T(b,n) is the smallest m such that for any N, at least one of S(N), S(N+1), ..., S(N+m-1) is divisible by n, where S(N) is the sum of digits of N in base b. Square array read by ascending antidiagonals.

Original entry on oeis.org

1, 1, 3, 1, 2, 7, 1, 3, 5, 15, 1, 2, 3, 8, 31, 1, 3, 5, 7, 17, 63, 1, 2, 5, 4, 15, 26, 127, 1, 3, 3, 7, 9, 15, 53, 255, 1, 2, 5, 6, 5, 14, 31, 80, 511, 1, 3, 5, 7, 9, 11, 29, 63, 161, 1023, 1, 2, 3, 4, 9, 6, 23, 24, 63, 242, 2047, 1, 3, 5, 7, 9, 11, 13, 35, 49, 127, 485, 4095
Offset: 2

Views

Author

Jianing Song, Jan 25 2020

Keywords

Comments

The main sequence is A331787; this is added because some people may search for this.

Examples

			Table begins
  b\n  1  2  3   4   5   6    7    8    9    10
   2   1  3  7  15  31  63  127  255  511  1023
   3   1  2  5   8  17  26   53   80  161   242
   4   1  3  3   7  15  15   31   63   63   127
   5   1  2  5   4   9  14   29   24   49    74
   6   1  3  5   7   5  11   23   35   47    35
   7   1  2  3   6   9   6   13   20   27    48
   8   1  3  5   7   9  11    7   15   31    47
   9   1  2  5   4   9  10   13    8   17    26
  10   1  3  3   7   9   9   13   15    9    19
		

Crossrefs

Cf. A331787.
Cf. A000225 (row 2), A062318 (row 3 with an offset shift), A331788 (row 10).

Programs

  • PARI
    T(b,n) = my(s=(n-1)\(b-1), t=(n-1)%(b-1)+1); b^s*(2*t-gcd(t,b-1)+1)-1

Formula

If n = (b-1)*s + t, 1 <= t <= b-1, then T(b,n) = b^s*(2*t-gcd(t,b-1)+1) - 1. See A331787 for a proof of the formula in base b.
T(b,k) = A331787(b,k) + 1.
T(b,n) = T(b,n-1) + b*T(b,n-b+1) - b*T(b,n-b) for b >= 2, n >= b+1.
T(b,n) = O(b^(n/(b-1))).

A112361 Number of terms in s(n), where s(n) is defined in A114483.

Original entry on oeis.org

1, 2, 5, 8, 17, 35, 53, 107, 215, 323, 647, 971, 1943, 3887, 5831, 11663, 23327, 46655, 69983, 139967, 209951, 419903, 839807, 1259711, 2519423, 5038847, 7558271, 15116543, 22674815, 45349631, 90699263, 136048895, 272097791, 544195583
Offset: 1

Views

Author

Leroy Quet, Nov 30 2005

Keywords

Examples

			As defined in A114483, s(4) = {1,0,1,0,1,1,0,1}; so a(4) = 8.
		

Crossrefs

Extensions

Corrected and extended by Joshua Zucker, Jul 27 2006

A114483 s(1)={1}. s(2)={1,0}. If a(n) = 0, s(n+2) = s(n+1) U s(n) U {1}. If a(n) = 1, s(n+2) = s(n+1) U s(n+1) U {1}. (U represents concatenation of finite sequences.) {a(n)} is the limit of {s(n)} as n -> infinity.

Original entry on oeis.org

1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1
Offset: 1

Views

Author

Leroy Quet, Nov 30 2005

Keywords

Comments

Number of terms in s(n) is A112361(n).

Examples

			s(3) = {1,0,1,0,1}, s(4) = {1,0,1,0,1,1,0,1}, s(5) = {1,0,1,0,1,1,0,1,1,0,1,0,1,1,0,1,1}
		

Crossrefs

Extensions

More terms from Joshua Zucker, Jul 27 2006

A319023 Let S be the sequence generated by these rules: 1 is in S, and if k is in S, then A057168(k) and A319021(k) are in S, and duplicates are deleted as they occur; a(n) is the n-th term of S.

Original entry on oeis.org

1, 2, 3, 4, 5, 9, 8, 6, 7, 10, 27, 16, 14, 11, 12, 29, 81, 32, 20, 19, 13, 17, 18, 30, 31, 82, 243, 64, 34, 24, 22, 21, 15, 23, 28, 39, 36, 47, 33, 84, 245, 729, 128, 66, 38, 25, 35, 43, 45, 40, 54, 55, 49, 37, 88, 90, 246, 247, 730, 2187, 256, 130, 68, 72, 41
Offset: 1

Views

Author

Rémy Sigrist, Sep 08 2018

Keywords

Comments

This sequence is a permutation of the natural numbers (with inverse A319024):
- this sequence is injective,
- this sequence is surjective: by contradiction:
- let m be the least integer missing from the sequence,
- as a(1) = 1, we have m > 1,
- also, m belongs to A000225 and to A062318,
- however the only positive integer belonging to both sequences is 1,
- hence a contradiction, QED.

Examples

			The first terms, alongside b(n) = A057168(a(n)) and t(n) = A319021(a(n)), are:
  n   a(n)  b(n)  t(n)
  --  ----  ----  ----
   1     1     2     3
   2     2     4     4
   3     3     5     9
   4     4     8     6
   5     5     6     7
   6     9    10    27
   7     8    16    14
   8     6     9    10
   9     7    11    11
  10    10    12    12
  11    27    29    81
  12    16    32    20
  13    14    19    16
  14    11    13    13
  15    12    17    18
  16    29    30    31
  17    81    82   243
  18    32    64    34
  19    20    24    22
  20    19    21    21
		

Crossrefs

Programs

  • PARI
    See Links section.

A356517 Square array A(n, k), n >= 2, k >= 0, read by antidiagonals upwards; A(n, k) is the least integer with sum of digits k in base n.

Original entry on oeis.org

0, 0, 1, 0, 1, 3, 0, 1, 2, 7, 0, 1, 2, 5, 15, 0, 1, 2, 3, 8, 31, 0, 1, 2, 3, 7, 17, 63, 0, 1, 2, 3, 4, 11, 26, 127, 0, 1, 2, 3, 4, 9, 15, 53, 255, 0, 1, 2, 3, 4, 5, 14, 31, 80, 511, 0, 1, 2, 3, 4, 5, 11, 19, 47, 161, 1023, 0, 1, 2, 3, 4, 5, 6, 17, 24, 63, 242, 2047
Offset: 2

Views

Author

Rémy Sigrist, Aug 10 2022

Keywords

Comments

The expansion of A(n, k) in base n is:
q n-1 ... n-1
<- p times ->
where q = k mod (n-1) and p = floor(k / (n-1)).

Examples

			Array A(n, k) begins:
  n\k|  0  1  2  3   4   5   6    7    8    9    10    11    12
  ---+---------------------------------------------------------
    2|  0  1  3  7  15  31  63  127  255  511  1023  2047  4095
    3|  0  1  2  5   8  17  26   53   80  161   242   485   728
    4|  0  1  2  3   7  11  15   31   47   63   127   191   255
    5|  0  1  2  3   4   9  14   19   24   49    74    99   124
    6|  0  1  2  3   4   5  11   17   23   29    35    71   107
    7|  0  1  2  3   4   5   6   13   20   27    34    41    48
    8|  0  1  2  3   4   5   6    7   15   23    31    39    47
    9|  0  1  2  3   4   5   6    7    8   17    26    35    44
   10|  0  1  2  3   4   5   6    7    8    9    19    29    39
Array A(n, k) begins (with values given in base n):
  n\k|  0  1   2    3     4      5       6        7         8          9
  ---+------------------------------------------------------------------
    2|  0  1  11  111  1111  11111  111111  1111111  11111111  111111111
    3|  0  1   2   12    22    122     222     1222      2222      12222
    4|  0  1   2    3    13     23      33      133       233        333
    5|  0  1   2    3     4     14      24       34        44        144
    6|  0  1   2    3     4      5      15       25        35         45
    7|  0  1   2    3     4      5       6       16        26         36
    8|  0  1   2    3     4      5       6        7        17         27
    9|  0  1   2    3     4      5       6        7         8         18
   10|  0  1   2    3     4      5       6        7         8          9
		

Crossrefs

Programs

  • PARI
    A(n,k) = { (1+k%(n-1))*n^(k\(n-1))-1 }
    
  • Python
    def A(n,k): return (1+(k % (n-1)))*n**(k//(n-1))-1

Formula

A(2, k) = 2^k - 1.
A(3, k) = A062318(k+1).
A(4, k) = A180516(k+1).
A(5, k) = A181287(k+1).
A(6, k) = A181288(k+1).
A(7, k) = A181303(k+1).
A(8, k) = A165804(k+1).
A(9, k) = A140576(k+1).
A(10, k) = A051885(k).
A(n, 0) = 0.
A(n, 1) = 1.
A(n, k) = k iff k < n.
A(n, n) = 2*n - 1.
A(n, n+1) = 3*n - 1 for any n > 2.

A372783 In the ternary expansion of n: keep the initial digit, and then replace 0's with 1's and 1's with 0's.

Original entry on oeis.org

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

Views

Author

Rémy Sigrist, May 13 2024

Keywords

Comments

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

Examples

			For n = 42: the ternary expansion of 42 is "1120", so the ternary expansion of a(42) is "1021", and a(42) = 34.
		

Crossrefs

Cf. A004488, A062318 (fixed points), A115303.

Programs

  • Mathematica
    Table[t3=IntegerDigits[n,3];fd=First[t3];tr=Rest[t3]/.{1->0,0->1};PrependTo[tr,fd];FromDigits[tr,3],{n,0,67}] (* James C. McMahon, May 31 2024 *)
  • PARI
    a(n) = { my (t = digits(n, 3)); for (i = 2, #t, t[i] = [1,0,2][1+t[i]];); fromdigits(t, 3); }

Formula

a(n) = n iff n belongs to A062318.

A358027 Expansion of g.f.: (1 + x - 2*x^2 + 2*x^4)/((1-x)*(1-3*x^2)).

Original entry on oeis.org

1, 2, 3, 6, 11, 20, 35, 62, 107, 188, 323, 566, 971, 1700, 2915, 5102, 8747, 15308, 26243, 45926, 78731, 137780, 236195, 413342, 708587, 1240028, 2125763, 3720086, 6377291, 11160260, 19131875, 33480782, 57395627
Offset: 0

Views

Author

G. C. Greubel, Oct 31 2022

Keywords

Crossrefs

Programs

  • Magma
    I:=[3,6,11]; [1,2] cat [n le 3 select I[n] else Self(n-1) +3*Self(n-2) -3*Self(n-3): n in [1..60]];
    
  • Mathematica
    LinearRecurrence[{1,3,-3}, {1,2,3,6,11}, 61]
  • SageMath
    def A254006(n): return 3^(n/2)*(1 + (-1)^n)/2
    def A358027(n): return (1/3)*( 4*A254006(n) + 7*A254006(n-1) +2*int(n==0) + 2*int(n==1) - 3 )
    [A358027(n) for n in (0..60)]

Formula

a(n) = (1/3)*(2*[n=0] + 2*[n=1] - 3 + 4*A254006(n) + 7*A254006(n-1)).
a(n) = a(n-1) - 3*a(n-2) + 3*a(n-3), for n >= 5.
E.g.f.: (1/3)*( 2 + 2*x - 3*exp(x) + 4*cosh(sqrt(3)*x) + (7/sqrt(3))*sinh(sqrt(3)*x) ).
G.f.: (1 +x -2*x^2 +2*x^4)/((1-x)*(1-3*x^2)). - Clark Kimberling, Oct 31 2022
Previous Showing 31-40 of 42 results. Next