Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
A320471
a(n) = floor(sqrt(n)) mod ceiling(sqrt(n)).
2
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,5
COMMENTS
Sequence consists of zeros interleaved with the positive integers, each positive integer k appearing 2k times.
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)
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 *)
PROG
(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
(Magma)
[Binomial(Ceiling(Sqrt(n)), Floor(Sqrt(n))) - 1: n in [1..100]]; // Vincenzo Librandi, Dec 02 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
CROSSREFS
KEYWORD
nonn
AUTHOR
Kritsada Moomuang, Oct 13 2018
EXTENSIONS
Corrected by Michel Marcus, Jun 14 2022
STATUS
approved