login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A100073 Number of representations of n as the difference of two positive squares. 7
0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 2, 1, 1, 0, 1, 1, 2, 0, 1, 2, 1, 0, 2, 1, 1, 0, 1, 2, 2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 1, 1, 3, 0, 1, 3, 1, 0, 2, 1, 1, 0, 2, 2, 2, 0, 1, 2, 1, 0, 3, 2, 2, 0, 1, 1, 2, 0, 1, 3, 1, 0, 3, 1, 2, 0, 1, 3, 2, 0, 1, 2, 2, 0, 2, 2, 1, 0, 2, 1, 2, 0, 2, 4, 1, 0, 3, 1, 1, 0, 1, 2, 4 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,15

COMMENTS

Note that for odd n, a(n) = 1 iff n is a prime, or a prime squared.

A decomposition n = a^2 - b^2 = (a-b)(a+b) = d*(n/d) is given for each divisor d less than (as to exclude b = 0) but having the same parity as n/d. For even n this implies that d and n/d must be even, i.e., 4 | n. This leads to the given formula, a(n) = floor(numdiv(n)/2) for odd n, floor(numdiv(n/4)/2) for n = 4k, 0 else. - M. F. Hasler, Jul 10 2018

LINKS

Robert Israel, Table of n, a(n) for n = 1..10000

A. Tripathi, On Pythagorean triples containing a fixed integer, Fib. Q., 46/47 (2008/2009), 331-340. See Theorem 5.

FORMULA

a(n) = A056924(n) for odd n, a(n) = A056924(n/4) if 4|n, otherwise a(n) = 0.

EXAMPLE

a(15) = 2 because 15 = 16 - 1 = 64 - 49.

MAPLE

f:= proc(n)

  if n::odd then floor(numtheory:-tau(n)/2)

  elif (n/2)::odd then 0

  else floor(numtheory:-tau(n/4)/2)

  fi

end proc:

map(f, [$1..200]); # Robert Israel, Jul 10 2018

MATHEMATICA

nn=150; a=Table[0, {nn}]; Do[y=x-1; While[d=x^2-y^2; d<=nn&&y>0, a[[d]]++; y-- ], {x, 1+nn/2}]; a

PROG

(PARI) a(n) = if (n % 2, ceil((numdiv(n)-1)/2), if (!(n%4),  ceil((numdiv(n/4)-1)/2), 0)); \\ Michel Marcus, Mar 07 2016

(PARI) A100073(n)=if(bittest(n, 0), numdiv(n)\2, !bittest(n, 1), numdiv(n\4)\2) \\ or shorter: a(n)=if(n%4!=2, numdiv(n\4^!(n%2))\2) \\ - M. F. Hasler, Jul 10 2018

CROSSREFS

Cf. A056924 (number of divisors of n that are less than sqrt(n)), A016825 (numbers not the difference of two squares), A034178 (number of representations of n as the difference of two squares).

Sequence in context: A026920 A060763 A131576 * A257988 A075685 A037906

Adjacent sequences:  A100070 A100071 A100072 * A100074 A100075 A100076

KEYWORD

easy,nonn

AUTHOR

T. D. Noe, Nov 02 2004

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 July 4 11:25 EDT 2020. Contains 335448 sequences. (Running on oeis4.)