A227782 - OEIS (original) (raw)

1, 2, 2, 1, 2, 2, 4, 2, 1, 2, 2, 2, 2, 2, 4, 1, 2, 2, 2, 2, 2, 2, 4, 2, 1, 2, 2, 4, 2, 2, 4, 2, 2, 2, 2, 1, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 4, 2, 1, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 4, 2, 2, 4, 1, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 4, 2, 1, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 4, 2

COMMENTS

If n >= 0 then Q(sqrt(n)) is formally real and its stufe is said to be infinite.

REFERENCES

Ian G. Connell, The stufe of number fields, Mathematische Zeitschrift 124:1 (1972), pp. 20-22.

A. R. Rajwade, Squares, Cambridge Univ. Press, 1983.

FORMULA

a(n) = 1 if n is a square; a(n) = 4 if n is of the form 4^k(8m+7) for some m; a(n) = 2 otherwise.

EXAMPLE

a(1) = a(4) = a(9) = 1 since Q(sqrt(-1)) = Q(sqrt(-4)) = Q(sqrt(-9)) = Q(i) has a square equal to -1: i^2 = -1.

a(3) = 2 since ((w+1)/2)^2 + ((w-1)/2)^2 = -1 where w = sqrt(-3).

PROG

(PARI) a(n)=n=core(n); if(n%8==7, 4, if(n==1, 1, 2))

(PARI) a(n)=n>>=(valuation(n, 2)\2*2); if(n%8==7, 4, 2-issquare(n))