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.

A025357 Numbers that are the sum of 4 nonzero squares in exactly 1 way.

Original entry on oeis.org

4, 7, 10, 12, 13, 15, 16, 18, 19, 20, 21, 22, 23, 25, 26, 27, 30, 33, 35, 38, 40, 44, 46, 48, 51, 53, 59, 62, 64, 65, 72, 80, 88, 89, 101, 104, 120, 152, 160, 176, 184, 192, 248, 256, 288, 320, 352, 416, 480, 608, 640, 704, 736, 768, 992, 1024, 1152, 1280, 1408, 1664
Offset: 1

Views

Author

Keywords

Crossrefs

Programs

  • Mathematica
    selQ[n_] := Length[ Select[ PowersRepresentations[n, 4, 2], Times @@ # != 0 &]] == 1; Reap[Do[If[selQ[n], Print[n]; Sow[n]], {n, 1, 2000}]][[2, 1]] (* Jean-François Alcover, Oct 03 2013 *)
    b[n_, i_, k_, t_] := b[n, i, k, t] = If[n == 0, If[t == 0, 1, 0], If[i<1 || t<1, 0, b[n, i - 1, k, t] + If[i^2 > n, 0, b[n - i^2, i, k, t - 1]]]];
    T[n_, k_] := b[n, Sqrt[n] // Floor, k, k];
    Position[Table[T[n, 4], {n, 0, 2000}], 1] - 1 // Flatten (* Jean-François Alcover, Nov 06 2020, after Alois P. Heinz in A243148 *)
  • Python
    # see link for faster version
    limit = 1664
    from functools import lru_cache
    sq = [k*k for k in range(1, int(limit**.5)+2) if k*k + 3 <= limit]
    sqs = set(sq)
    @lru_cache(maxsize=None)
    def findsums(n, m):
      if m == 1: return {(n,)} if n in sqs else set()
      return set(tuple(sorted(t+(s, ))) for s in sq for t in findsums(n-s, m-1))
    print([n for n in range(4, limit+1) if len(findsums(n, 4)) == 1]) # Michael S. Branicky, Apr 07 2021

Formula

{n: A025428(n) = 1}. - R. J. Mathar, Jun 15 2018
A243148(a(n),4) = 1. - Alois P. Heinz, Feb 25 2019