[go: up one dir, main page]

login
A005209
Multilevel sieve: at k-th step, accept k numbers, reject k, accept k, ...
(Formerly M2792)
4
1, 3, 9, 25, 57, 145, 337, 793, 1921, 3849, 8835, 18889, 41473, 92305, 203211, 432699, 944313, 2027529, 4077769, 8745153, 18133305, 37898113, 80713737, 169730259, 358760457, 750591867, 1575313473, 3255787851, 6751959507, 14108682265, 29364255033, 61173205587
OFFSET
1,2
COMMENTS
Start with the natural numbers. For k=1,2,3,... successively do the following: accept k numbers, reject k numbers, accept k numbers, repeat indefinitely.
REFERENCES
N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
LINKS
N. J. A. Sloane, Table of n, a(n) for n = 1..1000 [Computed using Tom Duff's bc program]
Popular Computing (Calabasas, CA), Contest 7 Results (based on solution from Tom Duff and Hugh Redelmeier), Vol. 4 (No. 43, Oct 1976), pp. 14-16. [Annotated scanned copy]
PROG
(bc)
for(k=1; k<=100; k++){
n=k;
for(i=k-1; i>=1; --i) n=2*n-((n-1)%i)-1;
print k, " ", n, "\n"
} /* Tom Duff, Apr 24 2015 */
(Python)
from itertools import count, islice
def agen(): # generator of terms
for k in count(1):
n = k
for i in range(k-1, 0, -1): n = 2*n-((n-1)%i)-1
yield n
print(list(islice(agen(), 32))) # Michael S. Branicky, Aug 06 2022 after Tom Duff
CROSSREFS
Sequence in context: A204448 A032681 A293852 * A112522 A005262 A101357
KEYWORD
nonn
STATUS
approved