%I #16 Dec 16 2022 09:00:57
%S 0,1,1,1,1,2,2,2,3,4,4,4,4,4,4,5,6,8,8,8,8,8,8,8,8,8,8,9,9,9,9,9,10,
%T 10,11,12,12,12,13,14,14,15,15,15,15,16,16,16,16,16,17,17,17,17,17,17,
%U 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,18
%N a(n) is the cardinality of the set of distinct pairwise gcd's of {1! + 1, ..., n! + 1}.
%e For n = 6 initial set is {1+1, 2+1, 6+1, 24+1, 120+1, 720+1} and after applying gcd for each distinct pair of elements we get {1, 7} set with cardinality of a(6) = 2.
%o (Python)
%o from math import gcd, factorial
%o from itertools import combinations
%o f, terms = [2,], []
%o for i in range(2,100):
%o f.append(factorial(i)+1)
%o terms.append(len(set([gcd(*t) for t in combinations(f, 2)])))
%o print(terms)
%o (Python)
%o from math import gcd
%o from itertools import count, islice
%o def A358178_gen(): # generator of terms
%o m, f, g = 1, [], set()
%o for n in count(1):
%o m *= n
%o g |= set(gcd(d,m+1) for d in f)
%o f.append(m+1)
%o yield len(g)
%o A358178_list = list(islice(A358178_gen(),20)) # _Chai Wah Wu_, Dec 15 2022
%Y Cf. A038507, A358127, A356371, A214799.
%K nonn
%O 1,6
%A _Gleb Ivanov_, Nov 02 2022