%I #8 Jan 24 2018 07:58:06
%S 65,145,217,325,485,561,721,785,901,904,1025,1105,1157,1261,1281,1333,
%T 1445,1729,1765,1905,1937,2117,2305,2465,2501,2701,2705,3126,3201,
%U 3365,3421,3565,3601,3845,4033,4097,4369,4625,4901,5185,5777,5833,6085,6401,6499
%N Composites c where another composite d < c exists such that c and d satisfy c^(d-1) == 1 (mod d^2) and d^(c-1) == 1 (mod c) or satisfy c^(d-1) == 1 (mod d) and d^(c-1) == 1 (mod c^2).
%C Are there any composites c where a composite d with d < c exists such that both c^(d-1) == 1 (mod d^2) and d^(c-1) == 1 (mod c^2)?
%e The composites 8 and 65 satisfy the congruences 65^(8-1) == 1 (mod 8^2) and 8^(65-1) == 1 (mod 65), so 65 is a term of the sequence.
%t With[{s = Select[Range@ 3000, CompositeQ]}, Select[s, Function[c, AnyTrue[Take[s, First@ FirstPosition[s, c]], Or[And[PowerMod[c, (# - 1), #^2] == 1, PowerMod[#, (c - 1), c] == 1], And[PowerMod[c, (# - 1), #] == 1, PowerMod[#, (c - 1), c^2] == 1]] &]]]] (* _Michael De Vlieger_, Jan 11 2018 *)
%o (PARI) is(n) = forcomposite(c=1, n-1, if((Mod(n, c^2)^(c-1)==1 && Mod(c, n)^(n-1)==1) || (Mod(n, c)^(c-1)==1 && Mod(c, n^2)^(n-1)==1), return(1))); 0
%o forcomposite(c=1, , if(is(c), print1(c, ", ")))
%Y Subsequence of A270574.
%K nonn
%O 1,1
%A _Felix Fröhlich_, Jan 07 2018