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.

A079644 a(n) = (n mod sqrtint(n)).

Original entry on oeis.org

0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 2, 0, 1, 2, 0, 0, 1, 2, 3, 0, 1, 2, 3, 0, 0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 0, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 0, 1, 2, 3, 4, 5, 6, 0, 1, 2, 3, 4, 5, 6, 0, 0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 0, 1, 2, 3, 4, 5, 6, 7, 8, 0, 0, 1, 2, 3, 4, 5
Offset: 1

Views

Author

Benoit Cloitre, Jan 31 2003

Keywords

Comments

Record values: given an m>=0, the first n for which a(n)=m is n = (m+1)^2+m = A028387(m). Also, for n>3, n is a square if and only if a(n)=0 and a(n-1)=0. - Stanislav Sykora, Aug 13 2014

Crossrefs

Programs

  • Maple
    a:= proc(n) local r;
    r:= isqrt(n);
    if r^2 > n then r:= r-1 fi;
    n mod r;
    end proc:
    seq(a(n),n=1..100); # Robert Israel, Aug 13 2014
  • Mathematica
    A079644[n_]:=Mod[n,Floor[n^(1/2)]]; Array[A079644,200] (* Enrique Pérez Herrero, Oct 06 2011 *)
    Table[Mod[n,Floor[Sqrt[n]]],{n,110}] (* Harvey P. Dale, Apr 10 2016 *)
  • PARI
    a(n)=n%sqrtint(n)

Formula

a(A006446(n))=0; a(A033638(n))=1.
When n>0, a(A000290(n))=0; when n>1, a(A000290(n)-1)=0. - Stanislav Sykora, Aug 13 2014
a(n) = 0 if n or n+1 or 4*n+1 is a square, otherwise a(n) = a(n-1)+1. - Robert Israel, Aug 13 2014
G.f.: Sum_{r>=2} x^(r^2) * (x^r + 1) * ((r-1)*x^(r+1) - r*x^r + x)/(1 - x)^2. - Robert Israel, Aug 13 2014

Extensions

Definition clarified by N. J. A. Sloane, Jan 11 2025