login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A055094 Binary encoding of quadratic residue set of n. L(1/n) is the most significant bit, L(n-1/n) is the least significant bit, i.e., the rows of A055088 interpreted as binary numbers. 10

%I #19 Mar 05 2016 06:04:12

%S 0,1,2,4,9,22,52,72,146,313,738,1156,2829,6772,9520,18496,53643,75154,

%T 162438,312328,600116,1513186,4023888,4737152,9741609,23182093,

%U 38478994,76286020,166236537,311977264,921787428,1212203072,2962424994

%N Binary encoding of quadratic residue set of n. L(1/n) is the most significant bit, L(n-1/n) is the least significant bit, i.e., the rows of A055088 interpreted as binary numbers.

%C L(a/n) stands for generalized Legendre symbol, with value = 1 only if a is a quadratic residue of n.

%F a(n) = qrs2bincode(n)

%p A055094 := proc(n)

%p local i, z;

%p z := 0;

%p for i from 1 to n-1 do

%p z := z*2;

%p if (1 = numtheory[quadres](i, n)) then

%p z := z + 1;

%p fi;

%p od;

%p return z;

%p end proc:

%t a[n_] := With[{rr = Table[Mod[k^2, n], {k, 1, n - 1}] // Union}, Boole[ MemberQ[rr, #]]& /@ Range[n - 1]] // FromDigits[#, 2]&; Array[a, 40] (* _Jean-François Alcover_, Mar 05 2016*)

%o (PARI) {a(n)=sum(k=1, n-1, 2^(k-1)*(0<sum(i=1, n-1, i^2%n==n-k)))} /* _Michael Somos_, Oct 14 2006 */

%o (Sage)

%o def A055094(n) :

%o Q = quadratic_residues(n)

%o z = 0

%o for i in (1..n-1) :

%o z = z*2

%o if i in Q : z += 1

%o return z

%o [A055094(n) for n in (1..33)] # _Peter Luschny_, Aug 08 2012

%Y Cf. A055088, A054432, A055095.

%K nonn

%O 1,3

%A _Antti Karttunen_, Apr 04 2000

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 24 12:54 EDT 2024. Contains 371943 sequences. (Running on oeis4.)