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.

A320471 a(n) = floor(sqrt(n)) mod ceiling(sqrt(n)).

Original entry on oeis.org

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

Views

Author

Kritsada Moomuang, Oct 13 2018

Keywords

Comments

Sequence consists of zeros interleaved with the positive integers, each positive integer k appearing 2k times.

Crossrefs

Programs

  • Magma
    [Binomial(Ceiling(Sqrt(n)), Floor(Sqrt(n))) - 1: n in [1..100]]; // Vincenzo Librandi, Dec 02 2018
    
  • Maple
    a:= proc(n) modp(floor(sqrt(n)),ceil(sqrt(n))) end: seq(a(n),n=1..100); # Muniru A Asiru, Oct 17 2018
  • Mathematica
    Array[Mod[Floor@ #, Ceiling@ #] &@ Sqrt@ # &, 99] (* or *)
    Array[IntegerPart@ # - If[IntegerQ@ #, #, 0] &@ Sqrt@ # &, 99] (* or *)
    Flatten@ Array[{0}~Join~ConstantArray[#, 2 #] &, 9] (* Michael De Vlieger, Oct 15 2018 *)
  • PARI
    a(n) = sqrtint(n) % (1+sqrtint(n-1)); \\ Michel Marcus, Nov 04 2018
    
  • PARI
    a(n) = sqrtint(n-1) * !issquare(n) \\ David A. Corneth, Nov 04 2018
    
  • Python
    from math import isqrt
    def A320471(n): return 0 if (m:=isqrt(n))**2==n else m # Chai Wah Wu, Jul 29 2022

Formula

a(n) = A000196(n) - A037213(n).
a(n) = A000196(n)*A049240(n).
a(n) = A000196(n) mod A003059(n).
a(n) = (n - A173517(n)) - A037213(n)^2.
a(n) = binomial(ceiling(sqrt(n)),floor(sqrt(n))) - 1.
From David A. Corneth, Nov 04 2018: (Start)
a(k^2) = 0.
a(m) = floor(sqrt(m)) for nonsquare m. (End)

Extensions

Corrected by Michel Marcus, Jun 14 2022