|
|
|
|
#23 by Michel Marcus at Mon May 22 12:39:47 EDT 2023
|
|
|
|
#22 by Joerg Arndt at Mon May 22 11:24:24 EDT 2023
|
|
|
|
#21 by Chai Wah Wu at Mon May 22 10:12:55 EDT 2023
|
|
|
|
#20 by Chai Wah Wu at Mon May 22 10:10:37 EDT 2023
|
| PROG
|
def inA071911(n): return not (n and sum(reduce(lambda x, y:(x[0], (x[0]+x[1])%3) if int(y) else ((x[0]+x[1])%3, x[1]), bin(n)[-1:2:-1], (1, 0)))%3)
def A071911_gen(startvalue=0): # generator of terms >= startvalue
return filter(lambda n:not (n and sum(reduce(lambda x, y:(x[0], (x[0]+x[1])%3) if int(y) else ((x[0]+x[1])%3, x[1]), bin(n)[-1:2:-1], (1, 0)))%3), count(max(startvalue, 0)))
return filter(inA071911, count(max(startvalue, 0)))
|
| STATUS
|
proposed
editing
|
|
|
Discussion
|
Mon May 22
| 10:12
| Chai Wah Wu: rewrote predicate as a separate function.
|
|
|
|
#19 by Chai Wah Wu at Thu May 18 13:35:40 EDT 2023
|
|
|
Discussion
|
Thu May 18
| 18:37
| Kevin Ryde: That's a predicate inside a generator? Might as well offer the predicate. Dijkstra's bit pattern is convenient for matching permitted bin() string.
|
Mon May 22
| 04:23
| Kevin Ryde: Since the guts of the code is a predicate, I believe it should be offered as a predicate function. A user who wants to make a generator by a filter would wrap it in the same way as any predicate. (Those dense enough to make that a reasonable proposition.)
|
|
|
|
#18 by Chai Wah Wu at Thu May 18 13:35:34 EDT 2023
|
| PROG
|
(Python)
from itertools import count, islice
from functools import reduce
def A071911_gen(startvalue=0): # generator of terms
return filter(lambda n:not (n and sum(reduce(lambda x, y:(x[0], (x[0]+x[1])%3) if int(y) else ((x[0]+x[1])%3, x[1]), bin(n)[-1:2:-1], (1, 0)))%3), count(max(startvalue, 0)))
A071911_list = list(islice(A071911_gen(), 20)) # Chai Wah Wu, May 18 2023
|
| STATUS
|
approved
editing
|
|
|
|
#17 by N. J. A. Sloane at Mon Jan 11 23:48:12 EST 2021
|
|
|
|
#16 by Kevin Ryde at Sun Jan 10 03:06:35 EST 2021
|
|
|
Discussion
|
Sun Jan 10
| 03:33
| Joerg Arndt: OK as well.
|
|
|
|
#15 by Kevin Ryde at Sun Jan 10 03:05:57 EST 2021
|
| NAME
|
Numbers km such that Stern's diatomic A002487(km) is divisible by 3.
|
| STATUS
|
proposed
editing
|
|
|
Discussion
|
Sun Jan 10
| 03:06
| Kevin Ryde: Oh, I've been k for length and m for each term so if the latter is ok.
|
|
|
|
#14 by Kevin Ryde at Sun Jan 10 03:04:46 EST 2021
|
|
|
|