%I #26 Sep 11 2022 12:05:30
%S 1,7,11,13,17,19,23,29,31,13,41,43,23,1,53,11,61,43,71,73,53,31,83,41,
%T 19,73,29,7,83,61,17,71
%N Smallest multiplication factors f, prime or 1, for all a (mod 120), coprime to 120, so that b*f is a nonzero square mod 8, mod 3, and mod 5.
%C See sequence A322269 for further explanations. This sequence is related to A322269(3).
%C The sequence is periodic, repeating itself after phi(120) terms. Its largest term is 83, which is A322269(3). In order to satisfy the conditions, both f and b must be coprime to 120. Otherwise, the product would be zero mod a prime <= 5.
%C The b(n) corresponding to each a(n) is A007775(n).
%e The 10th number coprime to 120 is 37. a(10) is 13, because 13 is the smallest prime by which we can multiply 37, so that the product (37*13 = 481) is a square mod 8, mod 3 and mod 5.
%o (PARI)
%o QresCode(n, nPrimes) = {
%o code = bitand(n,7)>>1;
%o for (j=2, nPrimes,
%o x = Mod(n,prime(j));
%o if (issquare(x), code += (1<<j));
%o );
%o return (code);
%o }
%o QCodeArray(n) = {
%o totalEntries = 1<<(n+1);
%o f = vector(totalEntries);
%o f[totalEntries3] = 1; \\ 1 always has the same code: ...111100
%o counter = 1;
%o forprime(p=prime(n+1), +oo,
%o code = QresCode(p, n);
%o if (f[code+1]==0,
%o f[code+1]=p;
%o counter += 1;
%o if (counter==totalEntries, return(f));
%o )
%o )
%o }
%o sequence(n) = {
%o f = QCodeArray(n);
%o primorial = prod(i=1, n, prime(i));
%o entries = eulerphi(4*primorial);
%o a = vector(entries);
%o i = 1;
%o forstep (x=1, 4*primorial1, 2,
%o if (gcd(x,primorial)==1,
%o a[i] = f[QresCode(x, n)+1];
%o i += 1;
%o );
%o );
%o return(a);
%o }
%o sequence(3)
%Y Cf. A322269, A322271, A322273, A322274, A322275, A007775.
%K nonn,fini,full
%O 1,2
%A _Hans Ruegg_, Dec 01 2018
