OFFSET
1,1
COMMENTS
a(n) is either prime or of form 3*a(m), m<n.
LINKS
Chai Wah Wu, Table of n, a(n) for n = 1..10000
PROG
(Python)
from itertools import count, islice
from sympy import isprime
def A106843_gen(startvalue=2): # generator of terms >= startvalue
for m in count(max(startvalue, 2)):
a, b = divmod(m, 3)
while not b:
a, b = divmod(a, 3)
if (k:=3*a+b)==1 or isprime(k):
yield m
CROSSREFS
KEYWORD
nonn
AUTHOR
Ralf Stephan, May 05 2005
STATUS
approved