%I #17 Nov 12 2021 12:19:53
%S 1,3,7,15,5,11,23,47,95,19,39,13,27,9,19,39,79,159,53,107,215,43,87,
%T 29,59,119,17,35,71,143,287,41,83,167,335,67,135,45,91,183,61,123,247,
%U 495,33,67,135,271,543,181,363,121,243,81,163,327,109,219,73,147,21,43,87,175,25,51,103,207,69,139,279,31,63
%N 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 2*t + 1 and repeat. See the Comments section for more details.
%H Michael De Vlieger, <a href="/A348872/a348872.png">Scatterplot of a(n)</a>, for n=1..2^16, accentuating smaller terms for clarity, labeling a(n) for n=1..32.
%e a(1) = 1 by definition; as 1 has no available divisor yet present in the sequence, we produce a(2) = 2*1 + 1 = 3.
%e a(2) = 3; as 3 has no available divisor yet present in the sequence, we produce a(3) = 2*3 + 1 = 7;
%e a(3) = 7; 7 has no available divisor yet present in the sequence, we produce a(4) = 2*7 + 1 = 15;
%e a(4) = 15; as 15 has 5 as its smallest divisor not yet present in the sequence, we have a(5) = 5.
%t a[1]=1;a[n_]:=a[n]=If[(s=Complement[Rest@Divisors@a[n-1],Array[a,n-1]])!={},Min@s,2a[n-1]+1];Array[a,73] (* _Giorgos Kalogeropoulos_, Nov 02 2021 *)
%t (* Second program generates a million terms in less than a minute: *)
%t c[_] = 0; c[1] = m = 1; {1}~Join~Reap[Do[Set[n, If[MissingQ[#], 2 m + 1, #]] &@ SelectFirst[Divisors[m], c[#] == 0 &]; c[n]++; Sow[n]; m = n, {i, 2^20}]][[-1, -1]]] (* _Michael De Vlieger_, Nov 05 2021 *)
%o (Python)
%o from sympy import divisors
%o terms = [1]
%o for i in range(100):
%o for j in divisors(terms[-1]):
%o if j not in terms:
%o terms.append(j)
%o break
%o else:
%o terms.append(terms[-1]*2+1)
%o print(terms) # _Gleb Ivanov_, Nov 09 2021
%Y Cf. A348871, A348873.
%K base,nonn
%O 1,2
%A _Eric Angelini_ and _Carole Dubois_, Nov 02 2021
|