login
This site is supported by donations to The OEIS Foundation.

 

Logo

Annual Appeal: Please make a donation to keep the OEIS running. In 2018 we replaced the server with a faster one, added 20000 new sequences, and reached 7000 citations (often saying "discovered thanks to the OEIS").
Other ways to donate

Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A060968 Number of solutions to x^2 + y^2 == 1 mod n. 17
1, 2, 4, 8, 4, 8, 8, 16, 12, 8, 12, 32, 12, 16, 16, 32, 16, 24, 20, 32, 32, 24, 24, 64, 20, 24, 36, 64, 28, 32, 32, 64, 48, 32, 32, 96, 36, 40, 48, 64, 40, 64, 44, 96, 48, 48, 48, 128, 56, 40, 64, 96, 52, 72, 48, 128, 80, 56, 60, 128, 60, 64, 96, 128, 48, 96, 68, 128, 96, 64, 72 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,2

LINKS

Charles R Greathouse IV, Table of n, a(n) for n = 1..10000

L. Tóth, Counting solutions of quadratic congruences in several variables revisited, arXiv preprint arXiv:1404.4214, 2014

L. Toth, Counting Solutions of Quadratic Congruences in Several Variables Revisited, J. Int. Seq. 17 (2014) # 14.11.6.

FORMULA

Multiplicative, with a(2^e) = 2 if e = 1 or 2^(e+1) if e > 1, a(p^e) = (p-1)p^(e-1) if p == 1 (mod 4), a(p^e) = (p+1)p^(e-1) if p == 3 (mod 4). - David W. Wilson, Jun 19 2001

a(n) = n * product{ 1 - 1/p, p is prime, p | n and p = 1 mod 4 } * product{ 1 + 1/p, p is prime, p | n and p = 3 mod 4 } * {2, if 4 | n } - Ola Veshta (olaveshta(AT)my-deja.com), May 18 2001

EXAMPLE

a(3) = 4 because the 4 solutions are: (0,1),(0,2),(1,0),(2,0)

MATHEMATICA

fa=FactorInteger; phi[p_, s_] := Which[Mod[p, 4] == 1, p^(s-1)*(p-1), Mod[p, 4]==3, p^(s-1)*(p+1), s==1, 2, True, 2^(s+1)]; phi[1]=1; phi[n_] := Product[phi[fa[n][[i, 1]], fa[n][[i, 2]]], {i, Length[fa[n]]}]; Table[phi[n], {n, 1, 100}]

PROG

(PARI) a(n)=my(f=factor(n)[, 1]); n*prod(i=if(n%2, 1, 2), #f, if(f[i]%4==1, 1-1/f[i], 1+1/f[i]))*if(n%4, 1, 2) \\ Charles R Greathouse IV, Apr 16 2012

(Haskell)

a060968 1 = 1

a060968 n = (if p == 2 then (if e == 1 then 2 else 2^(e+1)) else 1) *

   (product $ zipWith (*) (map (\q -> q - 2 + mod q 4) ps'')

                          (zipWith (^) ps'' (map (subtract 1) es'')))

   where (ps'', es'') = if p == 2 then (ps, es) else (ps', es')

         ps'@(p:ps) = a027748_row n; es'@(e:es) = a124010_row n

-- Reinhard Zumkeller, Aug 05 2014

CROSSREFS

Cf. A060594, A087784.

Cf. A027748, A124010.

Sequence in context: A031401 A191333 A078479 * A151569 A016635 A133992

Adjacent sequences:  A060965 A060966 A060967 * A060969 A060970 A060971

KEYWORD

nonn,easy,mult

AUTHOR

Ahmed Fares (ahmedfares(AT)my-deja.com), May 09 2001

STATUS

approved

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified December 17 02:35 EST 2018. Contains 318192 sequences. (Running on oeis4.)