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 11-20 of 23 results. Next

A327489 T(n, k) = 1 + NOR(k - 1, n - k), where NOR is the Peirce arrow operating bitwise on the inputs, triangle read by rows, T(n, k) for n >= 1, 1 <= k <= n.

Original entry on oeis.org

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

Views

Author

Peter Luschny, Sep 22 2019

Keywords

Examples

			                               1
                              1, 1
                            2, 1, 2
                           1, 1, 1, 1
                         4, 1, 2, 1, 4
                        3, 3, 1, 1, 3, 3
                      2, 3, 2, 1, 2, 3, 2
                     1, 1, 1, 1, 1, 1, 1, 1
                   8, 1, 2, 1, 4, 1, 2, 1, 8
                  7, 7, 1, 1, 3, 3, 1, 1, 7, 7
                6, 7, 6, 1, 2, 3, 2, 1, 6, 7, 6
               5, 5, 5, 5, 1, 1, 1, 1, 5, 5, 5, 5
             4, 5, 6, 5, 4, 1, 2, 1, 4, 5, 6, 5, 4
            3, 3, 5, 5, 3, 3, 1, 1, 3, 3, 5, 5, 3, 3
          2, 3, 2, 5, 2, 3, 2, 1, 2, 3, 2, 5, 2, 3, 2
         1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
		

Crossrefs

Cf. A327488 (Nand), A327490 (Iff), A280172 (Xor).
T(2n+1,n+1) gives A080079.

Programs

  • Maple
    A327489 := (n, k) -> 1 + Bits:-Nor(k-1, n-k):
    seq(seq(A327489(n, k), k=1..n), n=1..12);

A097327 Least positive integer m such that m*n has greater decimal digit length than n.

Original entry on oeis.org

10, 5, 4, 3, 2, 2, 2, 2, 2, 10, 10, 9, 8, 8, 7, 7, 6, 6, 6, 5, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 10, 10, 10
Offset: 1

Views

Author

Rick L. Shepherd, Aug 04 2004

Keywords

Comments

For any positive base B >= 2 the corresponding sequence contains only terms from 2 to B inclusive so the corresponding sequence for binary is all 2s (A007395).

Examples

			a(12) = 9 since 12 has two decimal digits and 9*12 = 108 has three (but 8*12 = 96 has only two).
		

Crossrefs

Cf. A089186 (analog for decimal m+n), A080079 (analog for binary m+n), A097326.
Cf. A055642.

Programs

  • Mathematica
    Table[Ceiling[10^IntegerLength[n]/n], {n, 100}] (* Paolo Xausa, Nov 02 2024 *)
  • PARI
    a(n) = my(m=1, sn=#Str(n)); while (#Str(m*n) <= sn, m++); m; \\ Michel Marcus, Oct 05 2021
  • Python
    def a(n): return (10**len(str(n))-1)//n + 1
    print([a(n) for n in range(1, 103)]) # Michael S. Branicky, Oct 05 2021
    

Formula

a(n) = A097326(n) + 1.
a(n) = ceiling(10^A055642(n)/n). - Michael S. Branicky, Oct 05 2021

A101267 a(1) = 1; a(n) = a(2^ceiling(log_2(n)) + 1 - n)th smallest positive integer not yet in the sequence.

Original entry on oeis.org

1, 2, 4, 3, 7, 9, 6, 5, 13, 15, 19, 17, 11, 14, 10, 8, 24, 27, 32, 29, 37, 40, 35, 33, 21, 23, 30, 26, 18, 22, 16, 12, 44, 49, 56, 52, 62, 67, 59, 57, 73, 76, 82, 79, 69, 74, 66, 63, 39, 43, 50, 46, 58, 64, 54, 51, 34, 38, 47, 42, 28, 36, 25, 20, 84, 90, 102, 94, 110, 116, 106
Offset: 1

Views

Author

Leroy Quet, Dec 18 2004

Keywords

Comments

Sequence is a permutation of the positive integers. 2^ceiling(log_2(n)) + 1 - n is sequence A080079 with a change of offset.

Examples

			Since 2^ceiling(log_2(n)) +1 -n = 3 at n = 6, a(6) = the a(3)th (the 4th) smallest positive integer not among the first 5 terms of the sequence. The positive integers not among the first 5 terms are 5,6,8,9,10,... The 4th of these is 9, which is a(6).
		

Crossrefs

Programs

  • Mathematica
    a[1] = 1; a[n_] := a[n] = Complement[ Range[100], Table[ a[i], {i, n - 1}]] [[ a[2^Ceiling[ Log[2, n]] + 1 - n]]]; Table[ a[n], {n, 71}] (* Robert G. Wilson v, Jan 13 2005 *)

Extensions

More terms from Robert G. Wilson v, Jan 13 2005

A240769 Triangle read by rows: T(1,1) = 1; T(n+1,k) = T(n,k+1), 1 <= k < n; T(n+1,n) = 2*T(n,1); T(n+1,n+1) = 2*T(n,1) - 1.

Original entry on oeis.org

1, 2, 1, 1, 4, 3, 4, 3, 2, 1, 3, 2, 1, 8, 7, 2, 1, 8, 7, 6, 5, 1, 8, 7, 6, 5, 4, 3, 8, 7, 6, 5, 4, 3, 2, 1, 7, 6, 5, 4, 3, 2, 1, 16, 15, 6, 5, 4, 3, 2, 1, 16, 15, 14, 13, 5, 4, 3, 2, 1, 16, 15, 14, 13, 12, 11, 4, 3, 2, 1, 16, 15, 14, 13, 12, 11, 10, 9, 3, 2
Offset: 1

Views

Author

Reinhard Zumkeller, Apr 13 2014

Keywords

Comments

Let h be the initial term of row n, to get row n+1, remove h and then append 2*h and 2*h+1;
A080079(n) = T(n,1); T(n,T(n,1)) = 1.

Examples

			.   1:   1
.   2:   2   1
.   3:   1   4   3
.   4:   4   3   2   1
.   5:   3   2   1   8   7
.   6:   2   1   8   7   6   5
.   7:   1   8   7   6   5   4   3
.   8:   8   7   6   5   4   3   2   1
.   9:   7   6   5   4   3   2   1  16  15
.  10:   6   5   4   3   2   1  16  15  14  13
.  11:   5   4   3   2   1  16  15  14  13  12  11
.  12:   4   3   2   1  16  15  14  13  12  11  10   9 .
		

Crossrefs

Cf. A062383 (row maxima).

Programs

  • Haskell
    a240769 n k = a240769_tabl !! (n-1) !! (k-1)
    a240769_row n = a240769_tabl !! (n-1)
    a240769_tabl = iterate (\(x:xs) -> xs ++ [2*x, 2*x-1]) [1]

A109849 a(1) = 1, a(2) = 2; a(n) = lcm(n, a(n-2)), a(n+1) = lcm((n+1), a(n-3)) and so on until a(2n-1) = lcm(2n-1, a(1)). Then a(2n) = lcm(2n, a(2n-2)) and so on.

Original entry on oeis.org

1, 2, 3, 4, 5, 12, 21, 8, 9, 40, 231, 12, 65, 28, 15, 16, 17, 144, 285, 140, 1365, 132, 5313, 120, 225, 104, 189, 84, 145, 60, 93, 32, 33, 544, 3255, 180, 5365, 1596, 2457, 520, 9225, 840, 228459, 132, 4095, 3220, 13395, 144, 833, 400, 255, 364, 3445, 108, 1155
Offset: 1

Views

Author

Amarnath Murthy, Jul 06 2005

Keywords

Comments

Another bootstrap sequence. 12 appears twice.
12 60 65 104 120 132 144 252 255 400 912 1008 1020 1980 2112 2457 4092 4095 ... are the smallest numbers that appear twice, with 4095 being the smallest number that appears three times. - Joshua Zucker, May 04 2006

Crossrefs

Cf. A109850.

Formula

For n > 2, a(n) = lcm(n, a(A080079(n-2))). - Ivan Neretin, Apr 30 2016

Extensions

More terms from Joshua Zucker, May 04 2006

A353157 a(n) is the distance from n to the nearest integer whose binary expansion has no common 1-bits with that of n.

Original entry on oeis.org

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

Views

Author

Rémy Sigrist, Apr 27 2022

Keywords

Comments

Equivalently the distance to the nearest integer that can be added without carries in base 2.

Examples

			For n = 42 ("101010" in binary):
- 21 ("10101") is the greatest number <= 42 that has no common 1-bits with 42,
- 128 ("1000000") is the least number >= 42 that has no common 1-bits with 42,
- so a(42) = min(42-21, 128-42) = min(21, 86) = 21.
		

Crossrefs

Programs

  • PARI
    a(n) = { my (high=2^#binary(n), low=high-1-n); min(n-low, high-n) }

Formula

a(n) = min(A006257(n), A080079(n)) for any n > 0.
a(n) = 1 iff n belongs to A097110.
a(n) = n/2 iff n belongs to A020988.
a(n) = n/4 iff n belongs to A108019.
2*a(n) - a(2*n) = 0 or 1.

A049929 a(n) = a(1) + a(2) + ... + a(n-1) - a(m) for n >= 4, where m = 2^(p+1) + 2 - n and p is the unique integer such that 2^p < n-1 <= 2^(p+1), starting with a(1) = 1, a(2) = 3, and a(3) = 4.

Original entry on oeis.org

1, 3, 4, 5, 12, 20, 41, 83, 168, 254, 550, 1121, 2250, 4507, 9015, 18031, 36064, 54098, 117212, 238932, 480121, 961371, 1923313, 3846922, 7693930, 15387945, 30775932, 61551885, 123103778, 246207563, 492415127, 984830255, 1969660512
Offset: 1

Views

Author

Keywords

Comments

Empirical: Lim_{n->infinity} a(n+1)/a(n) = 2. - Iain Fox, Dec 05 2017

Examples

			For n = 4, 2^p < 3 <= 2^(p+1), so p = 1, m = 2^2 + 2 - 4 = 2, and a(n) = a(1) + a(2) + a(3) - a(2) = 1 + 3 + 4 - 3 = 5.
For n = 6, 2^p < 5 <= 2^(p+1), so p = 2, m = 2^3 + 2 - 6 = 4, and a(n) = a(1) + a(2) + a(3) + a(4) + a(5) - a(4) = 1 + 3 + 4 + 5 + 12 - 5 = 20.
		

Crossrefs

Programs

  • Mathematica
    Fold[Append[#1, Total@ #1 - #1[[2^Ceiling@ Log2@ #2 + 1 - #2]] ] &, {1, 3, 4}, Range[3, 32]] (* Michael De Vlieger, Dec 06 2017 *)
  • PARI
    first(n)= my(res = vector(n), s = 8); res[1]=1; res[2]=3; res[3]=4; for(x=4, n, res[x] = s - res[2*2^logint(x-2, 2)+2-x]; s += res[x]); res; \\ Iain Fox, Dec 05 2017

Formula

a(n) = (Sum_{i=1..n-1} a(i)) - a(2^ceiling(log_2(n-1)) + 2 - n) for n > 3. - Iain Fox, Dec 06 2017
For n > 3, a(n) is the sum of all previous terms except a(A080079(n-2)). - Iain Fox, Dec 13 2017

Extensions

Name edited by Petros Hadjicostas, Nov 06 2019

A122872 Table by antidiagonals, T(n,k) is k-th number that starts with n in binary representation.

Original entry on oeis.org

1, 2, 2, 3, 4, 3, 4, 5, 6, 4, 5, 8, 7, 8, 5, 6, 9, 12, 9, 10, 6, 7, 10, 13, 16, 11, 12, 7, 8, 11, 14, 17, 20, 13, 14, 8, 9, 16, 15, 18, 21, 24, 15, 16, 9, 10, 17, 24, 19, 22, 25, 28, 17, 18, 10, 11, 18, 25, 32, 23, 26, 29, 32, 19, 20, 11, 12, 19, 26, 33, 40, 27, 30, 33, 36, 21, 22, 12
Offset: 1

Views

Author

Keywords

Comments

In rows n through 2n-1, every integer >= n occurs exactly once.

Examples

			Top left corner is:
1 2 3 4 5
2 4 5 8 9
3 6 7 12 13
4 8 9 16 17
5 10 11 20 21
		

Crossrefs

Rows: A000027, A004754, A004755, A004756, A004757, A004758, A004759. Algebraically, A053645 would be row zero, minus A080079 would be row minus one. See also A053644.

Formula

T(n,1) = n; T(n,2k) = 2T(n,k); T(n,2k+1) = 2T(n,k) + 1. T(n,k) = k + (n-1) * 2^floor(log_2(k)) = k + (n-1)*A053644(k).

A153587 a(n) = n mod (A062383(n) - n).

Original entry on oeis.org

0, 0, 0, 0, 0, 2, 0, 0, 0, 2, 4, 1, 0, 1, 0, 0, 0, 2, 4, 6, 8, 10, 2, 5, 0, 4, 2, 2, 0, 2, 0, 0, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 1, 4, 7, 10, 13, 0, 4, 8, 12, 4, 9, 4, 1, 0, 1, 4, 4, 0, 1, 0, 0, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42
Offset: 0

Views

Author

J. Z. Bradley (jzbradley(AT)gmail.com), Dec 29 2008

Keywords

Crossrefs

Programs

  • C
    int A062383(int n) { if(n==0) return 1; return 2*(A062383(n/2)); }
    int a(int n) { return n % (A062383(n)-n); }
    
  • PARI
    b(n) = if (n, 2*b(n\2), 1);
    a(n) = n % (n - b(n)); \\ Michel Marcus, Jan 28 2018
    
  • Python
    def A153587(n): return n % ((1 << n.bit_length())-n) # Chai Wah Wu, Jun 30 2022

Formula

a(n) = n mod A080079(n), for n > 0. - Michel Marcus, Jan 28 2018

Extensions

More terms from Michel Marcus, Jan 28 2018

A262617 First differences of A256266.

Original entry on oeis.org

0, 6, 12, 6, 24, 18, 12, 6, 48, 42, 36, 30, 24, 18, 12, 6, 96, 90, 84, 78, 72, 66, 60, 54, 48, 42, 36, 30, 24, 18, 12, 6, 192, 186, 180, 174, 168, 162, 156, 150, 144, 138, 132, 126, 120, 114, 108, 102, 96, 90, 84, 78, 72, 66, 60, 54, 48, 42, 36, 30, 24, 18, 12, 6, 384, 378, 372, 366, 360, 354, 348, 342, 336, 330, 324, 318
Offset: 0

Views

Author

Omar E. Pol, Oct 02 2015

Keywords

Comments

Number of cells turned ON at n-th stage of the cellular automaton of A256266.

Examples

			With the terms written as an irregular triangle in which the row lengths are the terms of A011782 the sequence begins:
0;
6;
12, 6;
24, 18, 12, 6;
48, 42, 36, 30, 24, 18, 12, 6;
96, 90, 84, 78, 72, 66, 60, 54, 48, 42, 36, 30, 24, 18, 12, 6;
...
Apart from the initial zero the rows list the initial terms of the positive multiples of 6 in decreasing order.
		

Crossrefs

Programs

  • PARI
    a(n) = if(n==0, 0, -6*n+12*2^floor(log(n)/log(2)));
    vector(100, n, a(n-1)) \\ Altug Alkan, Oct 04 2015

Formula

a(n) = 6 * A080079(n), n >= 1.
Previous Showing 11-20 of 23 results. Next