%I #178 Oct 05 2024 14:05:13
%S 0,1,3,4,5,7,8,9,11,12,13,15,16,17,19,20,21,23,24,25,27,28,29,31,32,
%T 33,35,36,37,39,40,41,43,44,45,47,48,49,51,52,53,55,56,57,59,60,61,63,
%U 64,65,67,68,69,71,72,73,75,76,77,79,80,81,83,84,85,87,88,89,91,92
%N Nonnegative integers not congruent to 2 mod 4.
%C Consider primitive Pythagorean triangles (A^2 + B^2 = C^2, (A, B) = 1, A <= B); sequence (starting at 3) gives values of AUB, sorted and duplicates removed. Values of AUBUC give same sequence. - _David W. Wilson_
%C These are the nonnegative integers that can be written as a difference of two squares, i.e., n = x^2 - y^2 for integers x,y. - Sharon Sela (sharonsela(AT)hotmail.com), Jan 25 2002. Equivalently, nonnegative numbers represented by the quadratic form x^2-y^2 of discriminant 4. The primes in this sequence are all the odd primes. - _N. J. A. Sloane_, May 30 2014
%C Numbers n such that Kronecker(4,n) == mu(gcd(4,n)). - _Jon Perry_, Sep 17 2002
%C Count, sieving out numbers of the form 2*(2*n+1) (A016825, "nombres pair-impairs"). A generalized Chebyshev transform of the Jacobsthal numbers: apply the transform g(x) -> (1/(1+x^2)) g(x/(1+x^2)) to the g.f. of A001045(n+2). Partial sums of 1,2,1,1,2,1,.... - _Paul Barry_, Apr 26 2005
%C For n>1, equals union of A020883 and A020884. - _Lekraj Beedassy_, Sep 28 2004
%C The sequence 1,1,3,4,5,... is the image of A001045(n+1) under the mapping g(x) -> g(x/(1+x^2)). - _Paul Barry_, Jan 16 2005
%C With offset 0 starting (1, 3, 4,...) = INVERT transform of A009531 starting (1, 2, -1, -4, 1, 6,...) with offset 0.
%C Apparently these are the regular numbers modulo 4 [Haukkanan & Toth]. - _R. J. Mathar_, Oct 07 2011
%C Numbers of the form x*y in nonnegative integers x,y with x+y even. - _Michael Somos_, May 18 2013
%C Convolution of A106510 with A000027. - _L. Edson Jeffery_, Jan 24 2015
%C Numbers that are the sum of zero or more consecutive odd positive numbers. - _Gionata Neri_, Sep 01 2015
%C Numbers that are congruent to {0, 1, 3} mod 4. - _Wesley Ivan Hurt_, Jun 10 2016
%C Nonnegative integers of the form (2+(3*m-2)/4^j)/3, j,m >= 0. - _L. Edson Jeffery_, Jan 02 2017
%C This is { x^2 - y^2; x >= y >= 0 }; with the restriction x > y one gets the same set without zero; with the restriction x > 0 (i.e., differences of two nonzero squares) one gets the set without 1. An odd number 2n-1 = n^2 - (n-1)^2, a number 4n = (n+1)^2 - (n-1)^2. - _M. F. Hasler_, May 08 2018
%D R. K. Guy, Unsolved Problems in Number Theory, Springer, 1st edition, 1981. See section D9.
%D J. V. Uspensky and M. A. Heaslet, Elementary Number Theory, McGraw-Hill, NY, 1939, p. 83.
%H Ray Chandler, <a href="/A042965/b042965.txt">Table of n, a(n) for n = 1..10000</a> (first 1000 terms from T. D. Noe)
%H Pentti Haukkanen and László Tóth, <a href="http://dx.doi.org/10.1007/s11139-011-9327-9">An analogue of Ramanujan's sum with respect to regular integers (mod r)</a>, Ramanujan J., Vol. 27, No. 1 (2012), pp. 71-88.
%H Ron Knott, <a href="http://www.maths.surrey.ac.uk/hosted-sites/R.Knott/Pythag/pythag.html">Pythagorean Triples and Online Calculators</a>.
%H N. J. A. Sloane et al., <a href="https://oeis.org/wiki/Binary_Quadratic_Forms_and_OEIS">Binary Quadratic Forms and OEIS</a> (Index to related sequences, programs, references).
%H <a href="/index/Rec#order_04">Index entries for linear recurrences with constant coefficients</a>, signature (1,0,1,-1).
%F Recurrence: a(n) = a(n-1) + a(n-3) - a(n-4) for n>4.
%F a(n) = n - 1 + (3n-3-sqrt(3)*(1-2*cos(2*Pi*(n-1)/3))*sin(2*Pi*(n-1)/3))/9. Partial sums of the period-3 sequence 0, 1, 1, 2, 1, 1, 2, 1, 1, 2, ... (A101825). - _Ralf Stephan_, May 19 2013
%F G.f.: A(x) = x^2*(1+x)^2/((1-x)^2*(1+x+x^2)); a(n)=Sum{k=0..floor(n/2)}, binomial(n-k-1, k)*A001045(n-2*k), n>0. - _Paul Barry_, Jan 16 2005, _R. J. Mathar_, Dec 09 2009
%F a(n) = floor((4*n-3)/3). - _Gary Detlefs_, May 14 2011
%F A214546(a(n)) != 0. - _Reinhard Zumkeller_, Jul 20 2012
%F From _Michael Somos_, May 18 2013: (Start)
%F Euler transform of length 3 sequence [3, -2, 1].
%F a(2-n) = -a(n). (End)
%F From _Wesley Ivan Hurt_, Jun 10 2016: (Start)
%F a(n) = (12*n-12+3*cos(2*n*Pi/3)+sqrt(3)*sin(2*n*Pi/3))/9.
%F a(3k) = 4k-1, a(3k-1) = 4k-3, a(3k-2) = 4k-4. (End)
%F a(n) = round((4*n-4)/3). - _Mats Granvik_, Sep 24 2016
%F The g.f. A(x) satisfies (A(x)/x)^2 + A(x)/x = x*B(x)^2, where B(x) is the o.g.f. of A042968. - _Peter Bala_, Apr 12 2017
%F Sum_{n>=2} (-1)^n/a(n) = log(sqrt(2)+2)/sqrt(2) - (sqrt(2)-1)*log(2)/4. - _Amiram Eldar_, Dec 05 2021
%F From _Peter Bala_, Aug 03 2022: (Start)
%F a(n) = a(floor(n/2)) + a(1 + ceiling(n/2)) for n >= 2, with a(2) = 1 and a(3) = 3.
%F a(2*n) = a(n) + a(n+1); a(2*n+1) = a(n) + a(n+2). Cf. A047222 and A006165. (End)
%F E.g.f.: (9 + 12*exp(x)*(x - 1) + exp(-x/2)*(3*cos(sqrt(3)*x/2) + sqrt(3)*sin(sqrt(3)*x/2)))/9. - _Stefano Spezia_, Apr 05 2023
%e G.f. = x^2 + 3*x^3 + 4*x^4 + 5*x^5 + 7*x^6 + 8*x^7 + 9*x^8 + 11*x^9 + 12*x^10 + ...
%p a_list := proc(len) local rec; rec := proc(n) option remember;
%p ifelse(n <= 4, [0, 1, 3, 4][n], rec(n-1) + rec(n-3) - rec(n-4)) end:
%p seq(rec(n), n=1..len) end: a_list(76); # _Peter Luschny_, Aug 06 2022
%t nn=100; Complement[Range[0,nn], Range[2,nn,4]] (* _Harvey P. Dale_, May 21 2011 *)
%t f[n_]:=Floor[(4*n-3)/3]; Array[f,70] (* _Robert G. Wilson v_, Jun 26 2012 *)
%t LinearRecurrence[{1, 0, 1, -1}, {0, 1, 3, 4}, 70] (* _L. Edson Jeffery_, Jan 21 2015 *)
%t Select[Range[0, 100], ! MemberQ[{2}, Mod[#, 4]] &] (* _Vincenzo Librandi_, Sep 03 2015 *)
%o (PARI) a(n)=(4*n-3)\3 \\ _Charles R Greathouse IV_, Jul 25 2011
%o (Haskell)
%o a042965 = (`div` 3) . (subtract 3) . (* 4)
%o a042965_list = 0 : 1 : 3 : map (+ 4) a042965_list
%o -- _Reinhard Zumkeller_, Nov 09 2012
%o (Magma) [n: n in [0..100] | not n mod 4 in 2]; // _Vincenzo Librandi_, Sep 03 2015
%Y Cf. A001045, A006165, A009531, A020883, A020884, A047209, A047222, A214546, A143978, A042968.
%Y Essentially the complement of A016825.
%Y See A267958 for these numbers multiplied by 4.
%K nonn,nice,easy
%O 1,3
%A _N. J. A. Sloane_
%E Edited by _N. J. A. Sloane_ at the suggestion of _Andrew S. Plewe_, Peter Pein and _Ralf Stephan_, Jun 17 2007
%E Typos fixed in _Gary Detlefs_'s formula and in PARI program by _Reinhard Zumkeller_, Nov 09 2012