cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-10 of 45 results. Next

A057756 Least nonnegative square root of -1 mod n for n in A008784.

Original entry on oeis.org

0, 1, 2, 3, 5, 4, 7, 5, 12, 13, 6, 9, 7, 23, 17, 11, 8, 27, 31, 9, 13, 34, 22, 10, 23, 33, 15, 11, 57, 47, 37, 12, 27, 44, 28, 70, 13, 80, 55, 19, 43, 81, 75, 14, 91, 32, 33, 21, 15, 107, 89, 64, 57, 16, 23, 82, 37, 60, 53, 38, 17, 138, 105
Offset: 1

Views

Author

N. J. A. Sloane, Nov 01 2000

Keywords

Crossrefs

Cf. A008784.

Programs

  • Mathematica
    A008784 = Select[ Range[300], And @@ (Mod[#, 4] == 1 & ) /@ (fi = FactorInteger[#]; If[ fi[[1]] == {2, 1}, Rest[ fi[[All, 1]]], fi[[All, 1]]])& ]; a[n_] := Min[r /. {ToRules[ Reduce[ Mod[r^2 + 1, A008784[[n]]] == 0, r, Integers] /. C[1] -> 0]}]; a[1] = 0; Table[a[n], {n, 1, 63}] (* Jean-François Alcover, Sep 19 2012 *)

Extensions

Corrected by T. D. Noe, Apr 19 2007 [The errors were caused by the faulty Maple command "mroot"]

A145215 a(n) is the minimal prime of the form 4k+1 for which s=A008784(n) is the minimal positive integer such that s*a(n)-floor(sqrt(s*a(n)))^2 is a square.

Original entry on oeis.org

5, 41, 353, 1237, 2749, 3037, 10369, 6569, 27253, 38561, 14897, 33289, 27917, 171629, 143513, 76081, 37649, 373273, 399181, 63029, 133157, 637601, 425197, 94261, 499321, 910853, 229849, 149837
Offset: 1

Views

Author

Vladimir Shevelev, Oct 05 2008

Keywords

Comments

See the conjecture in the comment at A145047. In addition, I conjecture that for every such s there exist infinitely many primes of the form 4k+1.

Crossrefs

Programs

  • PARI
    f(s)=forprime(p=2,,if(p%4>1 || !issquare(s*p-sqrtint(s*p)^2),next);for(i=1,s-1,if(issquare(i*p-sqrtint(i*p)^2), next(2)));return(p))
    S=select(n->if(n%2==0, if(n%4, n/=2, return(0))); n==1||vecmax(factor(n)[, 1]%4)==1, vector(150,i,i));
    apply(f, S) \\ Charles R Greathouse IV, Feb 07 2013

Extensions

a(22) corrected by Charles R Greathouse IV, Feb 07 2013

A340129 a(n) is the number of solutions of the Diophantine equation x^2 + y^2 = z^5 + z, gcd(x, y, z) = 1, x <= y, where z = A008784(n).

Original entry on oeis.org

1, 1, 2, 4, 2, 2, 4, 4, 2, 2, 4, 4, 4, 4, 4, 2, 4, 2, 2, 2, 16, 4, 4, 4, 2, 4, 2, 4, 4, 8, 8, 8, 4, 4, 4, 2, 8, 4, 16, 4, 16, 4, 2, 4, 16, 4, 4, 16, 4, 8, 8, 8, 4, 4, 8, 4, 8, 4, 4, 4, 16, 4, 4, 8, 2, 16, 2, 32, 2, 16, 4, 4, 2, 4, 8, 16, 4, 8, 4, 8, 4, 4, 8, 4, 16
Offset: 1

Views

Author

Bernard Schott, Jan 17 2021

Keywords

Comments

The idea of this sequence comes from the 6th problem of the 21st British Mathematical Olympiad in 1985 where it is asked to show that this equation has infinitely many solutions (see link Olympiads and reference Gardiner).
Indeed, this Diophantine equation x^2 + y^2 = z^5 + z with gcd(x, y, z) = 1 has solutions iff z is in A008784.
When z is in A008784, there exist (u, v), gcd(u, v) = 1 such that z = u^2 + v^2; then, (u*z^2-v)^2 + (u+v*z^2)^2 = z^5 + z. Hence, with x = min(u*z^2-v, u+v*z^2) and y = max(u*z^2-v, u+v*z^2), the equation x^2 + y^2 = z^5 + z is satisfied. So this equation has infinitely many solutions since it has at least one solution for each term of A008784.
For instance, for z = 10 we have:
with (u,v) = (1,3), then x = 1*10^2-3 = 97 and y = 1+3*10^2 = 301,
with (u,v) = (3,1), then x = 3+1*10^2 = 103 and y = 3*10^2-1 = 299,
so finally 97^2 + 301^2 = 103^2 + 299^2 = 10^5 + 10.
Note that some z, among them 10, have other solutions not of this form.

Examples

			For z = A008784(1) = 1, 1^2 + 1^2 = 1^5 + 1 is the only solution, so a(1) = 1.
For z = A008784(3) = 5, 23^2 + 51^2 = 27^2 + 49^2 = 5^5 + 5 so a(3) = 2.
For z = A008784(4) = 10, (97, 301, 10), (103, 299, 10), (119, 293, 10) and (163, 271, 10) are solutions, so a(4) = 4.
		

References

  • A. Gardiner, The Mathematical Olympiad Handbook: An Introduction to Problem Solving, Oxford University Press, 1997, reprinted 2011, Problem 6, pp. 63 and 167-168 (1985).

Crossrefs

Programs

  • Mathematica
    f[n_] := Length @ Solve[x^2 + y^2 == n^5 + n && GCD @@ {x, y, n} == 1 && 0 <= x <= y, {x, y}, Integers]; f /@ Select[Range[500], IntegerExponent[#, 2] < 2 && AllTrue[FactorInteger[#][[;; , 1]], Mod[#1, 4] < 3 &] &] (* Amiram Eldar, Jan 22 2021 *)
  • PARI
    f(z) = {if (issquare(Mod(-1, z)), my(nb = 0, s = z^5+z, d, j); for (i=1, sqrtint(s), if (issquare(d = s - i^2), j = sqrtint(d); if ((j<=i) && gcd([i, j, z]) == 1, nb++););); nb;);}
    lista(nn) = {for (n=1, nn, if (issquare(Mod(-1, n)), print1(f(n), ", ")););} \\ Michel Marcus, Jan 20 2021

Extensions

More terms from Michel Marcus, Jan 20 2021

A103216 Members of A103215 not in A008784.

Original entry on oeis.org

49, 77, 98, 121, 133, 154, 161, 209, 217, 242, 245, 253, 266, 301, 322, 329, 341, 361, 385, 413, 418, 434, 437, 469, 473, 490, 497, 506, 517, 529, 553, 581, 589, 602, 605, 637, 649, 658, 665, 682, 713, 721, 722, 737, 749, 770, 781, 805, 817, 826, 833, 869
Offset: 1

Views

Author

Ralf Stephan, Jan 28 2005

Keywords

Crossrefs

Programs

  • PARI
    v = [1, 2, 5, 10, 13, 17]; for (i = 0, 50, for (j = 1, 6, if (!issquare(Mod(-1, 24*i + v[j])), print1(24*i + v[j], ", ")))) \\ David Wasserman, Sep 20 2005

Extensions

More terms from David Wasserman, Oct 07 2005

A132662 Values of x such that x^2+y^2=n where x<=y for values of n given by A008784.

Original entry on oeis.org

0, 1, 1, 1, 2, 1, 3, 1, 2, 3, 1, 4, 1, 2, 3, 5, 1, 3, 5, 1, 6, 5, 4, 1, 5, 3, 7, 1, 2, 3, 4, 1, 5, 7, 6, 5, 1, 2, 3, 9, 4, 7, 5, 1, 9, 6, 7, 10, 1, 2, 8, 4, 9, 1, 11, 10, 7, 9, 5, 8, 1, 2, 3, 4, 12, 5, 11, 1, 9, 7, 11, 5, 8, 1, 13, 9, 7, 11, 5, 10, 13, 6, 1, 3, 11, 14, 13, 12, 1, 11, 7, 4, 13, 10, 5, 15
Offset: 1

Views

Author

Colin Barker, Aug 24 2007

Keywords

Crossrefs

A132663 Values of y such that x^2+y^2=n where x<=y for values of n given by A008784.

Original entry on oeis.org

1, 1, 2, 3, 3, 4, 4, 5, 5, 5, 6, 5, 7, 7, 7, 6, 8, 8, 7, 9, 7, 8, 9, 10, 9, 10, 8, 11, 11, 11, 11, 12, 11, 10, 11, 12, 13, 13, 13, 10, 13, 12, 13, 14, 11, 13, 13, 11, 15, 15, 13, 15, 13, 16, 12, 13, 15, 14, 16, 15, 17, 17, 17, 17, 13, 17, 14, 18, 16, 17, 15, 18, 17, 19, 14, 17, 18, 16
Offset: 1

Views

Author

Colin Barker, Aug 24 2007

Keywords

Crossrefs

A371479 Irregular triangle read by rows: row n lists the numbers k such that 1<=k<=N/2 and k/N + i/N is in the modular group orbit of i, for N = A008784(n).

Original entry on oeis.org

0, 1, 2, 3, 5, 4, 7, 5, 12, 13, 6, 9, 7, 23, 17, 11, 8, 18, 27, 31, 9, 13, 38, 34, 22, 10, 23, 33, 15, 11, 57, 47, 57, 37, 12, 17, 27, 44, 28, 70, 13, 47, 80, 55, 19, 43, 68, 81, 75, 14, 91, 32, 73, 33, 21, 47, 15, 107, 89, 64, 57, 16, 23, 83, 82, 37, 60, 53, 38, 17, 133, 138, 105, 72, 133, 25, 129, 114, 18, 57, 148, 99, 93, 136, 42, 19, 27, 173, 43, 117, 104, 70, 99, 81, 115, 183, 63
Offset: 1

Views

Author

Valerio De Angelis, Mar 26 2024

Keywords

Comments

The orbit of i under the action of the modular group (that is, the set {(ai+b)/(ci+d): a,b,c,d in Z, ad-bc=1}) is symmetric with respect to the imaginary axis, and periodic with period 1 relative to horizontal translations. So reflecting the orbit in the strip 0<=Re(z)<=1/2 across the imaginary axis and then translating horizontally by integer amounts gives the complete orbit of i in the complex plane.
The orbit in the strip 0<=Re(z)<=1/2 is the union of finite sets, one for each term of A008784, that correspond to the levels of {a(n)}. Each finite set is made of points with rational coordinates on horizontal lines with equation Im(z)=1/N, where N is a term of A008784. Starting at the top with n=1=A008784(1), we have only k=0, or i itself, corresponding to the identity element of the modular group. Then going down one level, at n=2=A008784(2), we have only k=1, or the element 1/2+i/2 corresponding to the modular group element ((1,0),(1,1)). Then at the next level n=3, we have A008784(3)=5, and we still have only one entry k=2, giving 2/5+i/5, corresponding to the matrix ((0,-1),(1,-2)). Continuing this way we find that all levels up to n=16 have only one term of the sequence. This is because if N=A008784(n), then for 1<=n<=16 the equation x^2+y^2=N has only one solution with (x,y) relatively prime. For n=17, we have A008784(17)=65 and (1,8), (4,7) are two solutions of x^2+y^2=65. So we find two terms of the sequence, 8 and 18, at level 17, corresponding to 8/65+i/65 and 18/65+i/65 in the orbit of i, with matrices ((0,-1),(1,-8)) and ((2,1),(7,4)).
So {a(n)} lists the numerators of the real part of the elements of the orbit of i in 0<=Re(z)<=1/2, as we descend the "floors", moving from left to right.
Here is how the sequence is constructed: Each N = A008784(n) can be expressed as the sum of two relatively prime squares. If N has s prime divisors, and all of them are of form 4k+1, then there will be 2^(s-1) solutions of x^2 + y^2 = N (see the MathStackExchange post cited in the Links section).
Consider one such solution, c^2+d^2=N. Let a,b be the unique integers given by the Euclidean algorithm such that ad-bc=1 (or equivalently, the pair of integers (x,y) at minimal distance from the origin such that cx-dy=1). It can be shown that ac+bd will be in {1,2,...,N-1} and relatively prime to N. Let k=min(ac+bd, N-ac-bd). Then k is in {1,2,...,N/2}. Do this for every possible solution of x^2+y^2=N, then list the resulting numbers (all contained in {1,2,3,...,N/2}) in increasing order. These will be the numerators of the rational numbers that are the real part of the points of the orbit of i with imaginary part 1/N. Row n of the triangle is then k1,k2,...,kr and r is the row length, which will always be a power of 2.
The connection with A057756 is as follows: the terms of A057756 are found as the first term of each level of {a(n)} (because A057756 is the numerator of the first rational number on a level of the orbit of i).

Examples

			For each row number n, the table below gives N=A008784(n), the number r of terms in the n-th row, and the values of those terms:
.
             terms in row n:
   n   N  r  k = 1   2 ... r
  --  --  -  ---------------
   1   1  1      0;
   2   2  1      1;
   3   5  1      2;
   4  10  1      3;
   5  13  1      5;
   6  17  1      4;
   7  25  1      7;
   8  26  1      5;
   9  29  1     12;
  10  34  1     13;
  11  37  1      6;
  12  41  1      9;
  13  50  1      7;
  14  53  1     23;
  15  58  1     17;
  16  61  1     11;
  17  65  2      8, 18;
  18  73  1     27;
  19  74  1     31;
  20  82  1      9;
  21  85  2     13, 38;
  ...
For row n=17, N=A008784(17)=65 and 65 has two representations as x^2+y^2: 65 = 1^2 + 8^2 = 7^2 + 4^2. For the pair (1,8), we have (a,b)=(1,7), so ac+bd=57, and -ab-cd = -57 == 8 (mod 65). For the pair (7,4) we have (a,b)=(2,1), so ac+bd=18 and -ac-bd = -18 == 47 (mod 65). Taking the minimum, we find that 8,18 will be consecutive terms in the sequence, and 8/65+i/65, 18/65+i/65 will be all the elements in the orbit of i with imaginary part 1/65 and real part in 0<=Re(z)<=1/2. The next level with two terms is A008784(21)=85.
		

Crossrefs

A002313 Primes congruent to 1 or 2 modulo 4; or, primes of form x^2 + y^2; or, -1 is a square mod p.

Original entry on oeis.org

2, 5, 13, 17, 29, 37, 41, 53, 61, 73, 89, 97, 101, 109, 113, 137, 149, 157, 173, 181, 193, 197, 229, 233, 241, 257, 269, 277, 281, 293, 313, 317, 337, 349, 353, 373, 389, 397, 401, 409, 421, 433, 449, 457, 461, 509, 521, 541, 557, 569, 577, 593, 601, 613, 617
Offset: 1

Views

Author

Keywords

Comments

Or, primes p such that x^2 - p*y^2 represents -1.
Primes which are not Gaussian primes (meaning not congruent to 3 mod 4).
Every Fibonacci prime (with the exception of F(4) = 3) is in the sequence. If p = 2n+1 is the prime index of the Fibonacci prime, then F(2n+1) = F(n)^2 + F(n+1)^2 is the unique representation of the prime as sum of two squares. - Sven Simon, Nov 30 2003
Except for 2, primes of the form x^2 + 4y^2. See A140633. - T. D. Noe, May 19 2008
Primes p such that for all p > 2, p XOR 2 = p + 2. - Brad Clardy, Oct 25 2011
Greatest prime divisor of r^2 + 1 for some r. - Michel Lagneau, Sep 30 2012
Empirical result: a(n), as a set, compose the prime factors of the family of sequences produced by A005408(j)^2 + A005408(j+k)^2 = (2j+1)^2 + (2j+2k+1)^2, for j >= 0, and a given k >= 1 for each sequence, with the addition of the prime factors of k if not already in a(n). - Richard R. Forberg, Feb 09 2015
Primes such that when r is a primitive root then p-r is also a primitive root. - Emmanuel Vantieghem, Aug 13 2015
Primes of the form (x^2 + y^2)/2. Note that (x^2 + y^2)/2 = ((x+y)/2)^2 + ((x-y)/2)^2 = a^2 + b^2 with x = a + b and y = a - b. More generally, primes of the form (x^2 + y^2) / A001481(n) for every fixed n > 1. - Thomas Ordowski, Jul 03 2016
Numbers n such that ((n-2)!!)^2 == -1 (mod n). - Thomas Ordowski, Jul 25 2016
Primes p such that (p-1)!! == (p-2)!! (mod p). - Thomas Ordowski, Jul 28 2016
The product of 2 different terms (x^2 + y^2)(z^2 + v^2) = (xz + yv)^2 + (xv - yz)^2 is sum of 2 squares (A000404) because (xv - yz)^2 > 0. If x were equal to yz/v then (x^2 + y^2)/(z^2 + v^2) would be equal to ((yz/v)^2 + y^2)/(z^2 + v^2) = y^2/v^2 which is not possible because (x^2 + y^2) and (z^2 + v^2) are prime numbers. For example, (2^2 + 5^2)(4^2 + 9^2) = (2*4 + 5*9)^2 + (2*9 - 5*4)^2. - Jerzy R Borysowicz, Mar 21 2017

Examples

			13 is in the sequence since it is prime and 13 = 4*3 + 1.  Also 13 = 2^2 + 3^2.  And -1 is a square (mod 13): -1 + 2*13 = 25 = 5^2.  Of course, only the first term is congruent to 2 (mod 4). - _Michael B. Porter_, Jul 04 2016
		

References

  • M. Abramowitz and I. A. Stegun, eds., Handbook of Mathematical Functions, National Bureau of Standards Applied Math. Series 55, 1964 (and various reprintings), p. 872.
  • David A. Cox, "Primes of the Form x^2 + n y^2", Wiley, 1989.
  • G. H. Hardy and E. M. Wright, An Introduction to the Theory of Numbers, 5th ed., Oxford Univ. Press, 1979, p. 219, th. 251, 252.
  • N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Apart from initial term, same as A002144. For values of x and y see A002330 and A002331.

Programs

  • Haskell
    a002313 n = a002313_list !! (n-1)
    a002313_list = filter ((`elem` [1,2]) . (`mod` 4)) a000040_list
    -- Reinhard Zumkeller, Feb 04 2014
    
  • Magma
    [p: p in PrimesUpTo(700) | p mod 4 in {1,2}]; // Vincenzo Librandi, Feb 18 2015
  • Maple
    with(numtheory): for n from 1 to 300 do if ithprime(n) mod 4 = 1 or ithprime(n) mod 4 = 2 then printf(`%d,`,ithprime(n)) fi; od:
    # alternative
    A002313 := proc(n)
        option remember ;
        local a;
        if n = 1 then
            2;
        elif n = 2 then
            5;
        else
            for a from procname(n-1)+4 by 4 do
                if isprime(a) then
                    return a ;
                end if;
            end do:
        end if;
    end proc:
    seq(A002313(n),n=1..100) ; # R. J. Mathar, Feb 01 2024
  • Mathematica
    Select[ Prime@ Range@ 115, Mod[#, 4] != 3 &] (* Robert G. Wilson v *)
    fQ[n_] := Solve[x^2 + 1 == n*y^2, {x, y}, Integers] == {}; Select[ Prime@ Range@ 115, fQ] (* Robert G. Wilson v, Dec 19 2013 *)
  • PARI
    select(p->p%4!=3, primes(1000)) \\ Charles R Greathouse IV, Feb 11 2011
    

Formula

a(n) ~ 2n log n. - Charles R Greathouse IV, Jul 04 2016
a(n) = A002331(n)^2 + A002330(n)^2. See crossrefs. - Wolfdieter Lang, Dec 11 2016

Extensions

More terms from Henry Bottomley, Aug 10 2000
More terms from James Sellers, Aug 22 2000

A000089 Number of solutions to x^2 + 1 == 0 (mod n).

Original entry on oeis.org

1, 1, 0, 0, 2, 0, 0, 0, 0, 2, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 2, 2, 0, 0, 2, 0, 0, 0, 0, 2, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 2, 0, 0, 0, 0, 2, 0, 0, 2, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 2, 2, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 4, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0, 0
Offset: 1

Views

Author

Keywords

Comments

Number of elliptic points of order 2 for GAMMA_0(n).
The Dirichlet inverse, 1, -1, 0, 1, -2, 0, 0, -1, 0, 2, 0, 0, -2, 0,.. seems to equal A091400, apart from signs. - R. J. Mathar, Jul 15 2010
Shadow transform of A002522. - Michel Marcus, Jun 06 2013
a(n) != 0 iff n in A008784. - Joerg Arndt, Mar 26 2014
For n > 1, number of positive solutions to n = a^2 + b^2 such that gcd(a, b) = 1. - Haehun Yang, Mar 20 2022

Examples

			G.f. = x + x^2 + 2*x^5 + 2*x^10 + 2*x^13 + 2*x^17 + 2*x^25 + 2*x^26 + 2*x^29 + ...
		

References

  • Michael Baake, "Solution of the coincidence problem in dimensions d <= 4", in R. V. Moody, ed., Mathematics of Long-Range Aperiodic Order, Kluwer, 1997, pp. 9-44.
  • Goro Shimura, Introduction to the Arithmetic Theory of Automorphic Functions, Princeton, 1971, see p. 25, Eq. (2).

Crossrefs

Cf. A031358, A027748, A124010, A000095, A006278 (positions of records), A002654, A093582.

Programs

  • Haskell
    a000089 n = product $ zipWith f (a027748_row n) (a124010_row n) where
       f 2 e = if e == 1 then 1 else 0
       f p _ = if p `mod` 4 == 1 then 2 else 0
    -- Reinhard Zumkeller, Mar 24 2012
    
  • Maple
    with(numtheory); A000089 := proc (n) local i, s; if modp(n,4) = 0 then RETURN(0) fi; s := 1; for i in divisors(n) do if isprime(i) and i > 2 then s := s*(1+eval(legendre(-1,i))) fi od; s end: # Gene Ward Smith, May 22 2006
  • Mathematica
    Array[ Function[ n, If[ EvenQ[ n ] || Mod[ n, 3 ]==2, 0, Count[ Array[ Mod[ #^2+1, n ]&, n, 0 ], 0 ] ] ], 84 ]
    a[ n_] := If[ n < 1, 0, Length @ Select[ (#^2 + 1)/n & /@ Range[n], IntegerQ]]; (* Michael Somos, Aug 15 2015 *)
    a[n_] := a[n] = Product[{p, e} = pe; Which[p<3 && e==1, 1, p==2 && e>1, 0, Mod[p, 4]==1, 2, Mod[p, 4]==3, 0, True, a[p^e]], {pe, FactorInteger[n]}]; Array[a, 105] (* Jean-François Alcover, Oct 18 2018, after David W. Wilson *)
  • PARI
    {a(n) = if( n<1, 0, sum( x=0, n-1, (x^2 + 1)%n==0))}; \\ Michael Somos, Mar 24 2012
    
  • PARI
    a(n)=my(o=valuation(n,2),f);if(o>1,0,n>>=o;f=factor(n)[,1]; prod(i=1,#f,kronecker(-1,f[i])+1)) \\ Charles R Greathouse IV, Jul 08 2013
    
  • Python
    from math import prod
    from sympy import primefactors
    def A000089(n): return prod(1 if p==2 else 2 if p&3==1 else 0 for p in primefactors(n)) if n&3 else 0 # Chai Wah Wu, Oct 13 2024

Formula

a(n) = 0 if 4|n, else a(n) = Product_{ p | N } (1 + Legendre(-1, p) ), where we use the definition that Legendre(-1, 2) = 0, Legendre(-1, p) = 1 if p == 1 mod 4, = -1 if p == 3 mod 4. This is Shimura's definition, which is different from Maple's.
Dirichlet g.f.: (1+2^(-s))*Product (1+p^(-s))/(1-p^(-s)) (p=1 mod 4).
Multiplicative with a(p^e) = 1 if p = 2 and e = 1; 0 if p = 2 and e > 1; 2 if p == 1 (mod 4); 0 if p == 3 (mod 4). - David W. Wilson, Aug 01 2001
a(3*n) = a(4*n) = a(4*n + 3) = 0. a(4*n + 1) = A031358(n). - Michael Somos, Mar 24 2012
Asymptotic mean: Limit_{m->oo} (1/m) * Sum_{k=1..m} a(k) = 3/(2*Pi) = 0.477464... (A093582). - Amiram Eldar, Oct 11 2022

A057126 Numbers k such that 2 is a square mod k.

Original entry on oeis.org

1, 2, 7, 14, 17, 23, 31, 34, 41, 46, 47, 49, 62, 71, 73, 79, 82, 89, 94, 97, 98, 103, 113, 119, 127, 137, 142, 146, 151, 158, 161, 167, 178, 191, 193, 194, 199, 206, 217, 223, 226, 233, 238, 239, 241, 254, 257, 263, 271, 274, 281, 287, 289, 302, 311, 313, 322
Offset: 1

Views

Author

Henry Bottomley, Aug 10 2000

Keywords

Comments

Numbers that are not multiples of 4 and for which all odd prime factors are congruent to +/- 1 mod 8. - Eric M. Schmidt, Apr 20 2013
Apparently the same as the list of numbers primitively represented by the indefinite quadratic form x^2 - 2y^2 (cf. A035251). - N. J. A. Sloane, Jun 11 2014
From Wolfdieter Lang, Jul 11 2025: (Start)
Also the negative sequence lists the numbers properly represented by the indefinite quadratic form x^2 - 2*y^2 of discriminant 4*2 = 8. For the proof see the W. Lang paper linked in A385449, Lemma 18, pp. 22-23.
The connection between the proper positive fundamental solutions (X, Y) of X^2 - 2*Y^2 = -a(n), given in A385449, and the solutions (x, y) of x^2 - 2*y^2 = a(n) is (x, y) = (2*Y - X, X - Y). If y becomes nonpositive a transformation with the matrix Mat([3,4], [2,3]) will give the positive proper fundamental solution. See the example section of A385449. See also the Nov 09 2009 comment in A035251 by Franklin T. Adams-Watters for this connection, and for the matrix eq. (38) p. 14 of the mentioned linked paper.
Therefore the previous statement on the representation of a(n) is true.(End)

Crossrefs

Includes the primes in A038873 and these (primes congruent to {1, 2, 7} mod 8) are the prime factors of the terms in this sequence.
Cf. A087780 (number of solutions mod n).

Programs

  • Maple
    with(numtheory); [seq(mroot(2,2,p),p=1..300)];
  • Mathematica
    ok[n_] := Reduce[ Mod[2 - k^2, n] == 0, k, Integers] =!= False; Prepend[ Select[ Range[400], ok], 1] (* Jean-François Alcover, Sep 20 2012 *)
  • PARI
    isok(n) = issquare(Mod(2,n)); \\ Michel Marcus, Feb 19 2016

Extensions

Checked by T. D. Noe, Apr 19 2007
Showing 1-10 of 45 results. Next