login
A348873
After a(1) = 1, the sequence is always extended with the smallest divisor d (not yet present in the sequence) of the last term t. If d doesn't exist, we extend the sequence with 3*t + 1 and repeat. See the Comments section for more details.
3
1, 4, 2, 7, 22, 11, 34, 17, 52, 13, 40, 5, 16, 8, 25, 76, 19, 58, 29, 88, 44, 133, 400, 10, 31, 94, 47, 142, 71, 214, 107, 322, 14, 43, 130, 26, 79, 238, 119, 358, 179, 538, 269, 808, 101, 304, 38, 115, 23, 70, 35, 106, 53, 160, 20, 61, 184, 46, 139, 418, 209, 628, 157, 472, 59, 178, 89, 268, 67, 202, 607, 1822, 911
OFFSET
1,2
EXAMPLE
a(1) = 1 by definition; as 1 has no available divisor yet present in the sequence, we produce a(2) = 3*1 + 1 = 4.
a(2) = 4; as 4 has 2 as its smallest divisor not yet present in the sequence, we have a(3) = 2;
a(3) = 2; as 2 has no available divisor yet present in the sequence, we produce a(4) = 3*2 + 1 = 7.
a(4) = 7; as 7 has no available divisor yet present in the sequence, we produce a(5) = 3*7 + 1 = 22.
a(5) = 22; as 22 has 11 as its smallest divisor not yet present in the sequence, we have a(6) = 11; etc.
MATHEMATICA
a[1]=1; a[n_]:=a[n]=If[(s=Complement[Rest@Divisors@a[n-1], Array[a, n-1]])!={}, Min@s, 3a[n-1]+1]; Array[a, 73] (* Giorgos Kalogeropoulos, Nov 02 2021 *)
PROG
(Python)
from sympy import divisors
terms = [1]
for i in range(100):
for j in divisors(terms[-1]):
if j not in terms:
terms.append(j)
break
else:
terms.append(terms[-1]*3+1)
print(terms) # Gleb Ivanov, Nov 09 2021
CROSSREFS
Sequence in context: A211941 A050105 A367209 * A128333 A375447 A201414
KEYWORD
base,nonn
AUTHOR
Eric Angelini and Carole Dubois, Nov 02 2021
STATUS
approved