login
a(n) is the smallest composite number coprime to n and n+1.
0

%I #18 Aug 16 2023 01:34:47

%S 9,25,25,9,49,25,9,25,49,9,25,25,9,121,49,9,25,25,9,121,25,9,25,49,9,

%T 25,25,9,49,49,9,25,25,9,121,25,9,25,49,9,25,25,9,49,49,9,25,25,9,49,

%U 25,9,25,49,9,25,25,9,49,49,9,25,25,9,49,25,9,25,121,9,25,25,9,49,49,9,25,25

%N a(n) is the smallest composite number coprime to n and n+1.

%F a(n) = A053670(n)^2.

%t m=0;Table[fla=1;Do[s=GCD[n, k]; s1=GCD[n, k+1];s2=GCD[n, k+2];s3=GCD[n, k+3]; If[Equal[s, 1]&&Equal[s1, 1]&&!PrimeQ[n]&&!Equal[n, 1]&& Equal[fla, 1], m=m+1;Print[n];fla=0], {n, 1, 1000}], {k, 1, 256}]

%o (Python)

%o from math import gcd

%o def a(n):

%o k, m = 3, n*(n+1)

%o while gcd(k, m) != 1: k += 2

%o return k*k

%o print([a(n) for n in range(1, 79)]) # _Michael S. Branicky_, Sep 25 2021

%Y Cf. A007978, A053669, A053670, A053671, A053672, A053673, A053674.

%Y Cf. A090092, A090093.

%K easy,nonn

%O 1,1

%A _Labos Elemer_, Nov 26 2003

%E Offset corrected by _Mohammed Yaseen_, Aug 15 2023