forked from UnlegitDqrk/unlegitlibrary
21 lines
530 B
Java
21 lines
530 B
Java
/*
|
|
* Copyright (C) 2024 UnlegitDqrk - All Rights Reserved
|
|
*
|
|
* You are unauthorized to remove this copyright.
|
|
* You have to give Credits to the Author in your project and link this GitHub site: https://github.com/UnlegitDqrk
|
|
* See LICENSE-File if exists
|
|
*/
|
|
|
|
package me.finn.unlegitlibrary.number.molecular;
|
|
|
|
public class MolecularAdd {
|
|
|
|
/**
|
|
* @param k is the start number
|
|
* @param n is the end number
|
|
**/
|
|
public static int useFormula(int k, int n) {
|
|
return ((n - k + 1) * (n + k)) / 2;
|
|
}
|
|
|
|
} |