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!)
A155918 Number of squared hypotenuses mod n in two dimensions. 6

%I #21 Feb 17 2024 04:04:00

%S 1,2,3,3,5,6,7,5,7,10,11,9,13,14,15,9,17,14,19,15,21,22,23,15,25,26,

%T 21,21,29,30,31,17,33,34,35,21,37,38,39,25,41,42,43,33,35,46,47,27,43,

%U 50,51,39,53,42,55,35,57,58,59,45,61,62,49,33,65,66,67,51,69,70,71,35,73

%N Number of squared hypotenuses mod n in two dimensions.

%C Number of images of the map (x,y) -> x^2+y^2 in Z_n.

%C Let n = p^e and k = r*p^b (gcd(r,p) = 1). If p == 1 (mod 4), then x^2 + y^2 == k (mod p) always have solutions; if p == 3 (mod 4), then x^2 + y^2 == k (mod p) is solvable if and only if b is even or b >= e; if p = 2, then x^2 + y^2 == k (mod p) is solvable if and only if r == 1 (mod 4) or b >= e - 1. If 0 <= k < n, then the number of solutions to x^2 + y^2 == k (mod n) is A305191(n,k). - _Jianing Song_, Apr 20 2019

%H Jianing Song, <a href="/A155918/b155918.txt">Table of n, a(n) for n = 1..10000</a> (first 1000 terms from Michel Marcus)

%F Multiplicative with a(p^e) = p^e if p == 1 (mod 4); ceiling(p^(e+1)/(p+1)) if p == 3 (mod 4); 2^(e-1) + 1 if p = 2. - _Jianing Song_, Apr 20 2019

%F Sum_{k=1..n} a(k) ~ c * n^2, where c = (11/24) * Product_{p prime == 3 (mod 4)} (1 - 1/p^3)/(1 - 1/p^4) = (11/24) * A334427/A334448 = 0.44532386516028771931... . - _Amiram Eldar_, Feb 17 2024

%t (For[v = Table[0, {m, 1, n^2}]; m = 1; i = 0, i < n, i++, For[j = 0, j < n, j++, v[[m]] = Mod[i^2 + j^2, n]; m = m + 1]]; Length[Union[v]])

%t (* Second program: *)

%t a[n_] := Module[{p, e}, Product[{p, e} = pe; Which[Mod[p, 4] == 1, p^e, Mod[p, 4] == 3, Ceiling[p^(e+1)/(p+1)], p == 2, 2^(e-1) + 1, True, p], {pe, FactorInteger[n]}]];

%t Array[a, 100] (* _Jean-François Alcover_, Jul 30 2020 *)

%o (PARI) a(n) = #Set(vector(n^2, i, ((i%n)^2 + (i\n)^2) % n)); \\ _Michel Marcus_, Jul 08 2017

%o (PARI) a(n)=

%o {

%o my(r=1, f=factor(n));

%o for(j=1, #f[, 1], my(p=f[j, 1], e=f[j, 2]);

%o if(p==2, r*=2^(e-1)+1);

%o if(p%4==1, r*=p^e);

%o if(p%4==3, r*=ceil(p^(e+1)/(p+1)));

%o );

%o return(r);

%o } \\ _Jianing Song_, Apr 20 2019

%Y Cf. A305191, A334427, A334448.

%K mult,nonn

%O 1,2

%A _Steven Finch_, Jan 30 2009

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 23 13:51 EDT 2024. Contains 371914 sequences. (Running on oeis4.)