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.

Showing 1-4 of 4 results.

A289322 Number of 1s in the first 2^n entries of the Kolakoski sequence, A000002.

Original entry on oeis.org

1, 1, 2, 4, 8, 17, 32, 64, 129, 256, 513, 1024, 2051, 4093, 8192, 16381, 32746, 65523, 131082, 262168, 524262, 1048547, 2097100, 4194345, 8388733, 16777351, 33554669, 67109796, 134219275, 268437750, 536872179
Offset: 0

Views

Author

Richard P. Brent, Jul 05 2017

Keywords

Examples

			The first 32 entries of the Kolakoski sequence, A000002, are 12211212212211211221211212211211. From this we see that a(5)=17, since among the first 2^5 letters, 17 of them are 1s.
		

Crossrefs

Cf. A000002. Analogous for powers of ten is A195206. Equivalent but with smaller entries is A289323. Closely related are A054353, A074286, A088568, A156077.

Formula

a(n) = (2^n + A088568(2^n))/2 = (2^n - A289323(n))/2.

A195211 Number of 2s in the first 10^n entries of the generalized Kolakoski-(2,3) sequence A071820.

Original entry on oeis.org

1, 5, 51, 502, 4995, 49999, 499980, 4999995, 50000202, 499999731, 5000005565, 50000013114, 499999997503, 4999999971938, 49999999974390, 499999999976909, 4999999999414101, 50000000022964476, 500000000029433861, 4999999999986496894
Offset: 0

Views

Author

Johan Nilsson, Sep 13 2011

Keywords

Examples

			The first entries of the Kolakoski-(2,3) sequence, A071820, are 2233222333... From this we see that a(0)=1, since the first letter is 2, and a(1) = 5 since among the first 10 letters 5 of them are 2s.
		

Crossrefs

Programs

Extensions

a(13)-a(14) from Ed Wynn, Jun 24 2014
a(15)-a(19) from Hiroaki Yamanouchi, Jul 25 2017

A289324 Number of twos minus number of ones in the first 10^n entries of the Kolakoski sequence, A000002.

Original entry on oeis.org

-1, 0, 2, -4, 8, 56, 28, -92, -1350, -2446, 4658, -3174, -101402, -16318, -632474, -1954842, 10724544, 45041304, 111069790, 548593100, 1818298480
Offset: 0

Views

Author

Richard P. Brent, Jul 07 2017

Keywords

Comments

This is equivalent to A195206, since a(n) = (#twos)-(#ones) = 10^n-2*(#ones) in the first 10^n entries of A000002.
For example, a(2) = 51 - 49 = (100 - 49) - 49 = 100 - 2*49 = 2 because there are 49 ones and 51 twos in the first 100 = 10^2 entries of A000002.
The entries in this sequence appear to be of order 10^(n/2), whereas the entries in A195206 are larger (of order 10^n).
This sequence is analogous to A289323; the difference is that the indices are powers of ten instead of powers of two.

Examples

			The first 10 entries in the Kolakoski sequence, A000002, are 1221121221. There are 5 ones and 5 twos, so a(1) = 5 - 5 = 0.
The first 100=10^2 entries in the Kolakoski sequence A000002 include 49 ones and 51 twos, so a(2) = 51 - 49 = 2.
		

References

Crossrefs

Formula

a(n) = 10^n - 2*A195206(n).

Extensions

Additional (20th) term from Richard P. Brent, Mar 01 2018

A342407 Number of 2's in the first 10^n entries of the Kolakoski sequence (A000002).

Original entry on oeis.org

0, 5, 51, 498, 5004, 50028, 500014, 4999954, 49999325, 499998777, 5000002329, 49999998413, 499999949299, 4999999991841, 49999999683763, 499999999022579, 5000000005362272, 50000000022520652, 500000000055534895, 5000000000274296550, 50000000000909149240
Offset: 0

Views

Author

Ishan Goel, Mar 11 2021

Keywords

Comments

This is a counterpart of A195206 in the sense that A195206 lists the number of 1's.

Examples

			The first 10 entries of the Kolakoski sequence (A000002) are 1221121221. From this we see that a(0) = 0, since the first term is not a 2, and a(1)=5 since among the first 10 terms, 5 of them are 2's.
		

Crossrefs

Cf. A000002. Counterpart of A195206.

Programs

  • Go
    package main
    import (
        "fmt"
        "math"
    )
    func main() {
        fmt.Println(a(5))
    }
    func a(n int) int {
        k := int(math.Pow(10, float64(n))) // get the number of terms of the Kolakoski sequence (A000002) to generate
        // seq stores the Kolakoski sequence
        seq := make([]int, 0, k+1) // n+1 because instruction 2 could add one extra
        var ind, i, toAppend int   // ind represents which instruction to follow
        seq = append(seq, 1, 2, 2) // initial terms
        ind = 2                    // follow third instruction next
        i += 3                     // three numbers already added
        for i < k {
            if seq[ind] == 1 { // add one number?
                if seq[len(seq)-1] == 1 {
                    toAppend = 2
                } else {
                    toAppend = 1
                }
                seq = append(seq, toAppend)
                i++   // we added a number
                ind++ // next instruction
            } else { // add two numbers
                if seq[len(seq)-1] == 1 {
                    toAppend = 2
                } else {
                    toAppend = 1
                }
                seq = append(seq, toAppend, toAppend) // append two numbers
                i += 2 // we added two numbers
                ind++
            }
        }
        seq = seq[:k] // trim to k values
        // now count twos
        var twos int
        for _, curr := range seq {
            if curr == 2 {
                twos++
            }
        }
        return twos
    }

Formula

a(n) = 10^n - A195206(n).
Showing 1-4 of 4 results.