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-2 of 2 results.

A375202 a(n) is the least integer x >= 0 such that n = x^2 + y^2 + z^2 for some integers y, z, or -1 if there is no such x.

Original entry on oeis.org

0, 0, 0, 1, 0, 0, 1, -1, 0, 0, 0, 1, 2, 0, 1, -1, 0, 0, 0, 1, 0, 1, 2, -1, 2, 0, 0, 1, -1, 0, 1, -1, 0, 1, 0, 1, 0, 0, 1, -1, 0, 0, 1, 3, 2, 0, 1, -1, 4, 0, 0, 1, 0, 0, 1, -1, 2, 2, 0, 1, -1, 0, 1, -1, 0, 0, 1, 3, 0, 1, 3, -1, 0, 0, 0, 1, 2, 2, 2, -1, 0, 0, 0, 1, 2, 0, 1, -1, 4, 0, 0, 1, -1, 2, 2
Offset: 0

Views

Author

Robert Israel, Oct 15 2024

Keywords

Examples

			a(12) = 2 because 12 = 2^2 + 2^2 + 2^2 but there are no integer solutions to 12 = 0^2 + y^2 + z^2 or 12 = 1^2 + y^2 + z^2.
		

Crossrefs

Programs

  • Maple
    f:= proc(n) local q,x,y,z;
      if n/4^padic:-ordp(n,4) mod 8 = 7 then return -1 fi;
      for x from 0 while 3*x^2 <= n do
        if [isolve(y^2 + z^2 = n - x^2)] <> [] then return x fi
      od;
    end proc;
    map(f, [$0..100]);
  • Python
    from math import isqrt
    from sympy import factorint
    def A375202(n):
        v = (~n & n-1).bit_length()
        if v&1^1 and n>>v&7==7: return -1
        for x in range(isqrt(n//3)+1):
            if not any(e&1 and p&3==3 for p, e in factorint(n-x**2).items()):
                return x # Chai Wah Wu, Oct 16 2024

Formula

a(n) = A064874(n) if a(n) >= 0.
If a(n) = -1 then a(4*n) = -1, otherwise a(4*n) = 2*a(n).

A375204 Record values in A375202.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 8, 9, 10, 12, 16, 18, 20, 24, 32, 36, 40, 48, 64, 72, 80, 96, 128, 144, 160, 192, 256, 288, 320, 384, 512, 576, 640, 768, 1024, 1152, 1280, 1536, 2048, 2304, 2560, 3072, 4096, 4608, 5120, 6144, 8192, 9216, 10240, 12288, 16384
Offset: 1

Views

Author

Robert Israel, Oct 15 2024

Keywords

Comments

Numbers k such that k = A375202(m) for some m such that A375202(j) < k for all j < m.
Conjectures: All powers of 2 (A000079), 3*(powers of 2) (A007283) and 5*(powers of 2) (A020714) are terms. All terms are 5-smooth (A051037). - Chai Wah Wu, Oct 16 2024

Examples

			a(3) = 2 because A375202(12) = 2 and A375202(j) <= 1 for j < 12.
		

Crossrefs

Programs

  • Maple
    f:= proc(n) local q, x, y, z;
      if n/4^padic:-ordp(n, 4) mod 8 = 7 then return -1 fi;
      for x from 0 while 3*x^2 <= n do
        if [isolve(y^2 + z^2 = n - x^2)] <> [] then return x fi
      od;
    end proc:
    V:= NULL:count:= 0: m:= -1;
    for i from 0 while count < 39 do
      v:= f(i);
      if v > m then
        V:= V, v; m:= v; count:=count+1
      fi
    od:
    V;
  • Python
    from itertools import count, islice
    from math import isqrt
    from sympy import factorint
    def A375204_gen(): # generator of terms
        c = -1
        for n in count(0):
            v = (~n & n-1).bit_length()
            if v&1 or n>>v&7!=7:
                a = next(x for x in range(isqrt(n//3)+1) if not any(e&1 and p&3==3 for p, e in factorint(n-x**2).items()))
                if a>c:
                    yield a
                    c = a
    A375204_list = list(islice(A375204_gen(),20)) # Chai Wah Wu, Oct 16 2024

Formula

a(n) = A375292(A375203(n)).

Extensions

a(35)-a(48) from Chai Wah Wu, Oct 16 2024
a(49)-a(52) from Chai Wah Wu, Oct 17 2024
Showing 1-2 of 2 results.