login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A372727 Triangle read by rows: T(n, k) = n if k = 0, otherwise n - k*floor(n/k). The binary modulo operation. 0
0, 1, 0, 2, 0, 0, 3, 0, 1, 0, 4, 0, 0, 1, 0, 5, 0, 1, 2, 1, 0, 6, 0, 0, 0, 2, 1, 0, 7, 0, 1, 1, 3, 2, 1, 0, 8, 0, 0, 2, 0, 3, 2, 1, 0, 9, 0, 1, 0, 1, 4, 3, 2, 1, 0, 10, 0, 0, 1, 2, 0, 4, 3, 2, 1, 0, 11, 0, 1, 2, 3, 1, 5, 4, 3, 2, 1, 0, 12, 0, 0, 0, 0, 2, 0, 5, 4, 3, 2, 1, 0 (list; table; graph; refs; listen; history; text; internal format)
OFFSET
0,4
COMMENTS
This binary operation 'mod' and the convention to set x mod y = x if y = 0 is discussed in 'Concrete Mathematics' by Graham et. al. on p. 82 and the connection with the congruence relation '(mod)' on p. 123.
REFERENCES
Ronald L. Graham, Donald E. Knuth and Oren Patashnik, Concrete Mathematics, 2nd ed., Addison-Wesley, 1994, 34th printing 2022.
LINKS
EXAMPLE
Triangle begins:
[ 0] 0;
[ 1] 1, 0;
[ 2] 2, 0, 0;
[ 3] 3, 0, 1, 0;
[ 4] 4, 0, 0, 1, 0;
[ 5] 5, 0, 1, 2, 1, 0;
[ 6] 6, 0, 0, 0, 2, 1, 0;
[ 7] 7, 0, 1, 1, 3, 2, 1, 0;
[ 8] 8, 0, 0, 2, 0, 3, 2, 1, 0;
[ 9] 9, 0, 1, 0, 1, 4, 3, 2, 1, 0;
[10] 10, 0, 0, 1, 2, 0, 4, 3, 2, 1, 0;
[11] 11, 0, 1, 2, 3, 1, 5, 4, 3, 2, 1, 0;
.
The triangle shows the modulo operation in the range 0 <= k <= n. Test your
computer implementation in the range R X R where R = [-6, ..., 0, ..., 6].
According to Graham et al. it should look like this:
0, -1, -2, 0, 0, 0, -6, 0, 0, 0, 2, 4, 0
-5, 0, -1, -2, -1, 0, -5, 0, 1, 1, 3, 0, 1
-4, -4, 0, -1, 0, 0, -4, 0, 0, 2, 0, 1, 2
-3, -3, -3, 0, -1, 0, -3, 0, 1, 0, 1, 2, 3
-2, -2, -2, -2, 0, 0, -2, 0, 0, 1, 2, 3, 4
-1, -1, -1, -1, -1, 0, -1, 0, 1, 2, 3, 4, 5
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-5, -4, -3, -2, -1, 0, 1, 0, 1, 1, 1, 1, 1
-4, -3, -2, -1, 0, 0, 2, 0, 0, 2, 2, 2, 2
-3, -2, -1, 0, -1, 0, 3, 0, 1, 0, 3, 3, 3
-2, -1, 0, -2, 0, 0, 4, 0, 0, 1, 0, 4, 4
-1, 0, -3, -1, -1, 0, 5, 0, 1, 2, 1, 0, 5
0, -4, -2, 0, 0, 0, 6, 0, 0, 0, 2, 1, 0
MAPLE
MOD := (n, k) -> ifelse(k = 0, n, n - k * iquo(n, k)):
seq( seq(MOD(n, k), k = 0..n), n = 0..12);
PROG
(Python)
def T(n, k): return n if k == 0 else n - k * (n // k)
for n in range(12): print([T(n, k) for k in range(n + 1)])
(Python)
def A372727_T(n, k): return n % k if k else n # Chai Wah Wu, May 14 2024
CROSSREFS
Cf. A111490 (row sums).
Cf. A048158.
Sequence in context: A212163 A212195 A228926 * A321414 A268865 A024159
KEYWORD
nonn,tabl
AUTHOR
Peter Luschny, May 13 2024
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified June 27 15:59 EDT 2024. Contains 373746 sequences. (Running on oeis4.)