Skip to content

Commit

Permalink
Kynea numbers (#31)
Browse files Browse the repository at this point in the history
* Kynea numbers

* Dependency updates
  • Loading branch information
reidhoch authored Jul 17, 2021
1 parent 6e9fc65 commit 31d09bd
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 8 deletions.
2 changes: 2 additions & 0 deletions oeis/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from .factorial import factorial
from .fibonacci import fibonacci
from .jacobsthal import jacobsthal
from .kynea import kynea
from .lazy_caterer import lazy_caterer
from .leonardo import leonardo
from .loeschian import loeschian
Expand Down Expand Up @@ -95,6 +96,7 @@
"hexagonal",
"hexagonal_pyramidal",
"jacobsthal",
"kynea",
"lazy_caterer",
"leonardo",
"loeschian",
Expand Down
12 changes: 12 additions & 0 deletions oeis/kynea.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# coding=utf-8
from itertools import count
from typing import Iterable

from oeis.registry import registry


@registry.register("A093069")
def kynea() -> Iterable[int]:
"""Kynea numbers."""
for n in count(start=1):
yield pow(pow(2, n) + 1, 2) - 2
45 changes: 37 additions & 8 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions tests/test_oeis.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
hexagonal,
hexagonal_pyramidal,
jacobsthal,
kynea,
lazy_caterer,
leonardo,
loeschian,
Expand Down Expand Up @@ -232,6 +233,12 @@ def test_jacobsthal() -> None:
assert actual == expected


def test_kynea() -> None:
expected: List[int] = [7, 23, 79, 287, 1087, 4223, 16639, 66047, 263167, 1050623]
actual: List[int] = list(islice(kynea(), 10))
assert actual == expected


def test_lazy_caterer() -> None:
expected: List[int] = [1, 2, 4, 7, 11, 16, 22, 29, 37, 46]
actual: List[int] = list(islice(lazy_caterer(), 10))
Expand Down

0 comments on commit 31d09bd

Please sign in to comment.