The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
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
0, 1, 2, 4, 9, 22, 52, 72, 146, 313, 738, 1156, 2829, 6772, 9520, 18496, 53643, 75154, 162438, 312328, 600116, 1513186, 4023888, 4737152, 9741609, 23182093, 38478994, 76286020, 166236537, 311977264, 921787428, 1212203072, 2962424994 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,3
COMMENTS
L(a/n) stands for generalized Legendre symbol, with value = 1 only if a is a quadratic residue of n.
LINKS
FORMULA
a(n) = qrs2bincode(n)
MAPLE
A055094 := proc(n)
local i, z;
z := 0;
for i from 1 to n-1 do
z := z*2;
if (1 = numtheory[quadres](i, n)) then
z := z + 1;
fi;
od;
return z;
end proc:
MATHEMATICA
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*)
PROG
(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 */
(Sage)
def A055094(n) :
Q = quadratic_residues(n)
z = 0
for i in (1..n-1) :
z = z*2
if i in Q : z += 1
return z
[A055094(n) for n in (1..33)] # Peter Luschny, Aug 08 2012
CROSSREFS
Sequence in context: A363771 A057580 A129875 * A369472 A055729 A317735
KEYWORD
nonn
AUTHOR
Antti Karttunen, Apr 04 2000
STATUS
approved

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 May 14 13:07 EDT 2024. Contains 372533 sequences. (Running on oeis4.)