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.

User: Greg Knowles

Greg Knowles's wiki page.

Greg Knowles has authored 2 sequences.

A194627 a(1)=1, a(n+1) = p(n)^2 + q(n)^2 + 1, where p(n) and q(n) are the number of prime and nonprime numbers respectively in the sequence so far.

Original entry on oeis.org

1, 2, 3, 6, 9, 14, 21, 30, 41, 46, 59, 66, 81, 98, 117, 138, 161, 186, 213, 242, 273, 306, 341, 378, 417, 458, 501, 546, 593, 602, 651, 702, 755, 810, 867, 926, 987, 1050, 1115, 1182, 1251, 1322, 1395, 1470, 1547, 1626, 1707, 1790, 1875, 1962, 2051, 2142
Offset: 1

Author

Greg Knowles, Sep 15 2011

Keywords

Examples

			For n=1, we have no primes and one nonprime (a(1)=1), so a(2)=0^2+1^2+1=2. Now we have one prime (a(2)=2) and one nonprime, so a(3)=1^2+1^2+1=3.
		

Crossrefs

Programs

A191598 a(1)=1. Then, if the first n terms contain all the numbers 1 to n, a(n+1)=2*a(n), otherwise a(n+1) is the smallest number not already in the sequence.

Original entry on oeis.org

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

Author

Greg Knowles, Jun 08 2011

Keywords

Examples

			There are no gaps with just one term, so we double to get a(2)=2. Still no gaps, so we double again to get a(3)=4. Now 3 has not appeared yet, so a(4)=3. The sequence is compact again, so we double to get a(5)=6.
		

Programs

  • Python
    from itertools import count, islice
    def agen():  # generator of terms
        an, aset, m = 1, {1}, 2
        for n in count(1):
            yield an
            an = 2*an if m > n else m
            aset.add(an)
            while m in aset: m += 1
    print(list(islice(agen(), 67))) # Michael S. Branicky, Nov 13 2024