Repository: sympy/sympy

Issue:
Limit involving modified bessel function not working as expected
This works 
```
>>> limit(besselk(0, x + 1)/besselk(0, x), x, oo)
exp(-1)
```
This doesn't
```
>>> limit(besseli(0, x + 1)/besseli(0, x), x, oo)
Limit(besseli(0, x + 1)/besseli(0, x), x, oo, dir='-')     # expected exp(1)
```
For reference [from wolfram](https://www.wolframalpha.com/input?i=limit+calculator&assumption=%7B%22F%22%2C+%22Limit%22%2C+%22limit%22%7D+-%3E%22oo%22&assumption=%7B%22F%22%2C+%22Limit%22%2C+%22limitfunction%22%7D+-%3E%22besseli%280%2C+x+%2B+1%29%2Fbesseli%280%2C+x%29%22&assumption=%22FSelect%22+-%3E+%7B%7B%22Limit%22%7D%2C+%22dflt%22%7D)

Discussion:

Patch:
diff --git a/.mailmap b/.mailmap
index 9260c4d775..72ed39f867 100644
--- a/.mailmap
+++ b/.mailmap
@@ -621,7 +621,6 @@ Geetika Vadali <geetika.vadali4@gmail.com> Geetika V <geetika047btcsai21@igdtuw.
 Geetika Vadali <geetika.vadali4@gmail.com> Geetika Vadali <123307246+geetHonve@users.noreply.github.com>
 Geoffry Song <goffrie@gmail.com>
 George Korepanov <gkorepanov.gk@gmail.com>
-George Pittock <gpittock4@gmail.com>
 George Waksman <waksman@gwax.com>
 Georges Khaznadar <georgesk@debian.org>
 Georgios Giapitzakis Tzintanos <giorgosgiapis@mail.com>
@@ -1471,7 +1470,6 @@ Vladimir Perić <vlada.peric@gmail.com>
 Vladimir Poluhsin <vovapolu@gmail.com>
 Waldir Pimenta <waldyrious@gmail.com>
 Wang Ran (汪然) <wangr@smail.nju.edu.cn>
-Warren Jacinto <warrenjacinto@gmail.com>
 Wes Galbraith <galbwe92@gmail.com>
 Wes Turner <50891+westurner@users.noreply.github.com>
 Willem Melching <willem.melching@gmail.com>
@@ -1502,7 +1500,6 @@ Zach Raines <raineszm@gmail.com>
 Zachariah Etienne <zachetie@gmail.com>
 Zamrath Nizam <zamiguy_ni@yahoo.com> <zamiguy.ni@gmail.com>
 Zaz Brown <zazbrown@zazbrown.com>
-Zedmat <104870914+harshkasat@users.noreply.github.com>
 Zeel Shah <kshah215@gmail.com>
 Zhi-Qiang Zhou <zzq_890709@hotmail.com> zhouzq-thu <zzq_890709@hotmail.com>
 Zhongshi <zj495@nyu.edu>
diff --git a/doc/src/explanation/active-deprecations.md b/doc/src/explanation/active-deprecations.md
index 062c9830fc..422192ecec 100644
--- a/doc/src/explanation/active-deprecations.md
+++ b/doc/src/explanation/active-deprecations.md
@@ -429,14 +429,6 @@ purely a property of the domain object itself rather than of the elements and
 so the ``to_int`` method that depends on this must be a domain method rather
 than an element method.
 
-(deprecated-ntheory-symbolic-functions)=
-### Cleaning up symbolic version functions in ``ntheory``
-
-Symbolic functions in ``ntheory`` have been moved to ``functions``.
-Specifically, the following functions.
-
-* ``sympy.ntheory.residue_ntheory.mobius``
-
 
 ## Version 1.12
 
diff --git a/doc/src/modules/functions/combinatorial.rst b/doc/src/modules/functions/combinatorial.rst
index 965b1638ad..86089e2810 100644
--- a/doc/src/modules/functions/combinatorial.rst
+++ b/doc/src/modules/functions/combinatorial.rst
@@ -57,9 +57,6 @@ This module implements various combinatorial functions.
 .. autoclass:: sympy.functions.combinatorial.numbers.partition
    :members:
 
-.. autoclass:: sympy.functions.combinatorial.numbers.mobius
-   :members:
-
 .. autoclass:: sympy.functions.combinatorial.factorials.MultiFactorial
    :members:
 
diff --git a/doc/src/modules/ntheory.rst b/doc/src/modules/ntheory.rst
index 54976f7eee..2bc7c2747a 100644
--- a/doc/src/modules/ntheory.rst
+++ b/doc/src/modules/ntheory.rst
@@ -183,8 +183,6 @@ Ntheory Functions Reference
 
 .. autofunction:: kronecker_symbol
 
-.. autofunction:: mobius
-
 .. autofunction:: discrete_log
 
 .. autofunction:: quadratic_congruence
@@ -199,6 +197,9 @@ Ntheory Functions Reference
 .. automodule:: sympy.ntheory.digits
    :members:
 
+.. autoclass:: sympy.ntheory.mobius
+   :members:
+
 .. module:: sympy.ntheory.egyptian_fraction
 
 .. autofunction:: egyptian_fraction
diff --git a/sympy/__init__.py b/sympy/__init__.py
index 6cacaeef8f..7290080907 100644
--- a/sympy/__init__.py
+++ b/sympy/__init__.py
@@ -112,7 +112,7 @@ def __sympy_debug():
 from .functions import (factorial, factorial2, rf, ff, binomial,
         RisingFactorial, FallingFactorial, subfactorial, carmichael,
         fibonacci, lucas, motzkin, tribonacci, harmonic, bernoulli, bell, euler,
-        catalan, genocchi, andre, partition, mobius, sqrt, root, Min, Max, Id,
+        catalan, genocchi, andre, partition, sqrt, root, Min, Max, Id,
         real_root, Rem, cbrt, re, im, sign, Abs, conjugate, arg, polar_lift,
         periodic_argument, unbranched_argument, principal_branch, transpose,
         adjoint, polarify, unpolarify, sin, cos, tan, sec, csc, cot, sinc,
@@ -143,7 +143,7 @@ def __sympy_debug():
         is_deficient, is_amicable, abundance, npartitions, is_primitive_root,
         is_quad_residue, legendre_symbol, jacobi_symbol, n_order, sqrt_mod,
         quadratic_residues, primitive_root, nthroot_mod, is_nthpow_residue,
-        sqrt_mod_iter, discrete_log, quadratic_congruence,
+        sqrt_mod_iter, mobius, discrete_log, quadratic_congruence,
         binomial_coefficients, binomial_coefficients_list,
         multinomial_coefficients, continued_fraction_periodic,
         continued_fraction_iterator, continued_fraction_reduce,
@@ -334,7 +334,7 @@ def __sympy_debug():
     'factorial', 'factorial2', 'rf', 'ff', 'binomial', 'RisingFactorial',
     'FallingFactorial', 'subfactorial', 'carmichael', 'fibonacci', 'lucas',
     'motzkin', 'tribonacci', 'harmonic', 'bernoulli', 'bell', 'euler', 'catalan',
-    'genocchi', 'andre', 'partition', 'mobius', 'sqrt', 'root', 'Min', 'Max', 'Id', 'real_root',
+    'genocchi', 'andre', 'partition', 'sqrt', 'root', 'Min', 'Max', 'Id', 'real_root',
     'Rem', 'cbrt', 're', 'im', 'sign', 'Abs', 'conjugate', 'arg', 'polar_lift',
     'periodic_argument', 'unbranched_argument', 'principal_branch',
     'transpose', 'adjoint', 'polarify', 'unpolarify', 'sin', 'cos', 'tan',
@@ -371,7 +371,7 @@ def __sympy_debug():
     'is_primitive_root', 'is_quad_residue', 'legendre_symbol',
     'jacobi_symbol', 'n_order', 'sqrt_mod', 'quadratic_residues',
     'primitive_root', 'nthroot_mod', 'is_nthpow_residue', 'sqrt_mod_iter',
-    'discrete_log', 'quadratic_congruence', 'binomial_coefficients',
+    'mobius', 'discrete_log', 'quadratic_congruence', 'binomial_coefficients',
     'binomial_coefficients_list', 'multinomial_coefficients',
     'continued_fraction_periodic', 'continued_fraction_iterator',
     'continued_fraction_reduce', 'continued_fraction_convergents',
diff --git a/sympy/functions/__init__.py b/sympy/functions/__init__.py
index 4a3b337205..b916ba8338 100644
--- a/sympy/functions/__init__.py
+++ b/sympy/functions/__init__.py
@@ -8,7 +8,7 @@
 from sympy.functions.combinatorial.factorials import (factorial, factorial2,
         rf, ff, binomial, RisingFactorial, FallingFactorial, subfactorial)
 from sympy.functions.combinatorial.numbers import (carmichael, fibonacci, lucas, tribonacci,
-        harmonic, bernoulli, bell, euler, catalan, genocchi, andre, partition, mobius, motzkin)
+        harmonic, bernoulli, bell, euler, catalan, genocchi, andre, partition, motzkin)
 from sympy.functions.elementary.miscellaneous import (sqrt, root, Min, Max,
         Id, real_root, cbrt, Rem)
 from sympy.functions.elementary.complexes import (re, im, sign, Abs,
@@ -54,7 +54,7 @@
     'FallingFactorial', 'subfactorial',
 
     'carmichael', 'fibonacci', 'lucas', 'motzkin', 'tribonacci', 'harmonic',
-    'bernoulli', 'bell', 'euler', 'catalan', 'genocchi', 'andre', 'partition', 'mobius',
+    'bernoulli', 'bell', 'euler', 'catalan', 'genocchi', 'andre', 'partition',
 
     'sqrt', 'root', 'Min', 'Max', 'Id', 'real_root', 'cbrt', 'Rem',
 
diff --git a/sympy/functions/combinatorial/numbers.py b/sympy/functions/combinatorial/numbers.py
index 44bd5e648f..1f52d9fe13 100644
--- a/sympy/functions/combinatorial/numbers.py
+++ b/sympy/functions/combinatorial/numbers.py
@@ -17,13 +17,12 @@
 from sympy.core.logic import fuzzy_not
 from sympy.core.mul import Mul
 from sympy.core.numbers import E, I, pi, oo, Rational, Integer
-from sympy.core.relational import Eq, is_le, is_gt, is_lt
+from sympy.core.relational import Eq, is_le, is_gt
 from sympy.external.gmpy import SYMPY_INTS
 from sympy.functions.combinatorial.factorials import (binomial,
     factorial, subfactorial)
 from sympy.functions.elementary.exponential import log
 from sympy.functions.elementary.piecewise import Piecewise
-from sympy.ntheory.factor_ import factorint
 from sympy.ntheory.primetest import isprime, is_square
 from sympy.polys.appellseqs import bernoulli_poly, euler_poly, genocchi_poly
 from sympy.utilities.enumerative import MultisetPartitionTraverser
@@ -1677,86 +1676,6 @@ def _eval_is_positive(self):
             return True
 
 
-class mobius(Function):
-    """
-    Mobius function maps natural number to {-1, 0, 1}
-
-    It is defined as follows:
-        1) `1` if `n = 1`.
-        2) `0` if `n` has a squared prime factor.
-        3) `(-1)^k` if `n` is a square-free positive integer with `k`
-           number of prime factors.
-
-    It is an important multiplicative function in number theory
-    and combinatorics.  It has applications in mathematical series,
-    algebraic number theory and also physics (Fermion operator has very
-    concrete realization with Mobius Function model).
-
-    Examples
-    ========
-
-    >>> from sympy.functions.combinatorial.numbers import mobius
-    >>> mobius(13*7)
-    1
-    >>> mobius(1)
-    1
-    >>> mobius(13*7*5)
-    -1
-    >>> mobius(13**2)
-    0
-
-    Even in the case of a symbol, if it clearly contains a squared prime factor, it will be zero.
-
-    >>> from sympy import Symbol
-    >>> n = Symbol("n", integer=True, positive=True)
-    >>> mobius(4*n)
-    0
-    >>> mobius(n**2)
-    0
-
-    References
-    ==========
-
-    .. [1] https://en.wikipedia.org/wiki/M%C3%B6bius_function
-    .. [2] Thomas Koshy "Elementary Number Theory with Applications"
-    .. [3] https://oeis.org/A008683
-
-    """
-    is_integer = True
-    is_prime = False
-
-    @classmethod
-    def eval(cls, n):
-        if n.is_integer is False:
-            raise TypeError("n should be an integer")
-        if n.is_positive is False:
-            raise ValueError("n should be a positive integer")
-        if n.is_prime is True:
-            return S.NegativeOne
-        if n is S.One:
-            return S.One
-        result = None
-        for m, e in (_.as_base_exp() for _ in Mul.make_args(n)):
-            if m.is_integer is True and m.is_positive is True and \
-               e.is_integer is True and e.is_positive is True:
-                lt = is_lt(S.One, e) # 1 < e
-                if lt is True:
-                    result = S.Zero
-                elif m.is_Integer is True:
-                    factors = factorint(m)
-                    if any(v > 1 for v in factors.values()):
-                        result = S.Zero
-                    elif lt is False:
-                        s = S.NegativeOne if len(factors) % 2 else S.One
-                        if result is None:
-                            result = s
-                        else:
-                            result *= s
-            else:
-                return
-        return result
-
-
 #######################################################################
 ###
 ### Functions for enumerating partitions, permutations and combinations
diff --git a/sympy/matrices/determinant.py b/sympy/matrices/determinant.py
index 90d319c5a3..2738622406 100644
--- a/sympy/matrices/determinant.py
+++ b/sympy/matrices/determinant.py
@@ -419,7 +419,7 @@ def _charpoly(M, x='lambda', simplify=_simplify):
 
     cp = dM.charpoly()
 
-    x = uniquely_named_symbol(x, [M], modify=lambda s: '_' + s)
+    x = uniquely_named_symbol(x, M, modify=lambda s: '_' + s)
 
     if K.is_EXRAW or simplify is not _simplify:
         # XXX: Converting back to Expr is expensive. We only do it if the
diff --git a/sympy/matrices/expressions/trace.py b/sympy/matrices/expressions/trace.py
index b5f9f94ea7..6c9a1232ce 100644
--- a/sympy/matrices/expressions/trace.py
+++ b/sympy/matrices/expressions/trace.py
@@ -145,7 +145,7 @@ def get_arg_key(x):
 
     def _eval_rewrite_as_Sum(self, expr, **kwargs):
         from sympy.concrete.summations import Sum
-        i = uniquely_named_symbol('i', [expr])
+        i = uniquely_named_symbol('i', expr)
         s = Sum(self.arg[i, i], (i, 0, self.arg.rows - 1))
         return s.doit()
 
diff --git a/sympy/matrices/matrixbase.py b/sympy/matrices/matrixbase.py
index f29276e390..479a142362 100644
--- a/sympy/matrices/matrixbase.py
+++ b/sympy/matrices/matrixbase.py
@@ -1262,12 +1262,10 @@ def wilkinson(kls, n, **kwargs):
         return klass._eval_wilkinson(n)
 
     def _eval_atoms(self, *types):
-        values = self.values()
-        if len(values) < self.rows * self.cols and isinstance(S.Zero, types):
-            s = {S.Zero}
-        else:
-            s = set()
-        return s.union(*[v.atoms(*types) for v in values])
+        result = set()
+        for i in self:
+            result.update(i.atoms(*types))
+        return result
 
     def _eval_free_symbols(self):
         return set().union(*(i.free_symbols for i in self if i))
diff --git a/sympy/matrices/solvers.py b/sympy/matrices/solvers.py
index 01a85b29be..76e47bb3d5 100644
--- a/sympy/matrices/solvers.py
+++ b/sympy/matrices/solvers.py
@@ -590,7 +590,7 @@ def _gauss_jordan_solve(M, B, freevar=False):
 
     # Free parameters
     # what are current unnumbered free symbol names?
-    name = uniquely_named_symbol('tau', [aug],
+    name = uniquely_named_symbol('tau', aug,
             compare=lambda i: str(i).rstrip('1234567890'),
             modify=lambda s: '_' + s).name
     gen  = numbered_symbols(name)
diff --git a/sympy/ntheory/residue_ntheory.py b/sympy/ntheory/residue_ntheory.py
index c837d3762b..775b9e5337 100644
--- a/sympy/ntheory/residue_ntheory.py
+++ b/sympy/ntheory/residue_ntheory.py
@@ -1,5 +1,7 @@
 from __future__ import annotations
 
+from sympy.core.function import Function
+from sympy.core.singleton import S
 from sympy.external.gmpy import (gcd, lcm, invert, sqrt, legendre, jacobi,
                                  kronecker, bit_scan1, remove)
 from sympy.polys import Poly
@@ -8,7 +10,6 @@
 from .primetest import isprime
 from .factor_ import factorint, _perfect_power
 from .modular import crt
-from sympy.utilities.decorator import deprecated
 from sympy.utilities.memoization import recurrence_memo
 from sympy.utilities.misc import as_int
 from sympy.utilities.iterables import iproduct
@@ -1206,20 +1207,11 @@ def kronecker_symbol(a, n):
     """
     return int(kronecker(as_int(a), as_int(n)))
 
-@deprecated("""\
-The `sympy.ntheory.residue_ntheory.mobius` has been moved to `sympy.functions.combinatorial.numbers.mobius`.""",
-deprecated_since_version="1.13",
-active_deprecations_target='deprecated-ntheory-symbolic-functions')
-def mobius(n):
+
+class mobius(Function):
     """
     Mobius function maps natural number to {-1, 0, 1}
 
-    .. deprecated:: 1.13
-
-        The ``mobius`` function is deprecated. Use :class:`sympy.functions.combinatorial.numbers.mobius`
-        instead. See its documentation for more information. See
-        :ref:`deprecated-ntheory-symbolic-functions` for details.
-
     It is defined as follows:
         1) `1` if `n = 1`.
         2) `0` if `n` has a squared prime factor.
@@ -1256,8 +1248,22 @@ def mobius(n):
     .. [2] Thomas Koshy "Elementary Number Theory with Applications"
 
     """
-    from sympy.functions.combinatorial.numbers import mobius as _mobius
-    return _mobius(n)
+    @classmethod
+    def eval(cls, n):
+        if n.is_integer:
+            if n.is_positive is not True:
+                raise ValueError("n should be a positive integer")
+        else:
+            raise TypeError("n should be an integer")
+        if n.is_prime:
+            return S.NegativeOne
+        elif n is S.One:
+            return S.One
+        elif n.is_Integer:
+            a = factorint(n)
+            if any(i > 1 for i in a.values()):
+                return S.Zero
+            return S.NegativeOne**len(a)
 
 
 def _discrete_log_trial_mul(n, a, b, order=None):
diff --git a/sympy/printing/latex.py b/sympy/printing/latex.py
index ae90524867..a3e78fc0e1 100644
--- a/sympy/printing/latex.py
+++ b/sympy/printing/latex.py
@@ -15,7 +15,7 @@
 from sympy.core.sorting import default_sort_key
 from sympy.core.sympify import SympifyError
 from sympy.logic.boolalg import true, BooleanTrue, BooleanFalse
-
+from sympy.tensor.array import NDimArray
 
 # sympy.printing imports
 from sympy.printing.precedence import precedence_traditional
@@ -30,7 +30,6 @@
 import re
 
 if TYPE_CHECKING:
-    from sympy.tensor.array import NDimArray
     from sympy.vector.basisdependent import BasisDependent
 
 # Hand-picked functions which can be used directly in both LaTeX and MathJax
@@ -2220,11 +2219,6 @@ def _print_lucas(self, expr, exp=None):
     def _print_tribonacci(self, expr, exp=None):
         return self.__print_number_polynomial(expr, "T", exp)
 
-    def _print_mobius(self, expr, exp=None):
-        if exp is None:
-            return r'\mu\left(%s\right)' % self._print(expr.args[0])
-        return r'\mu^{%s}\left(%s\right)' % (exp, self._print(expr.args[0]))
-
     def _print_SeqFormula(self, s):
         dots = object()
         if len(s.start.free_symbols) > 0 or len(s.stop.free_symbols) > 0:
diff --git a/sympy/series/limits.py b/sympy/series/limits.py
index 174ce38967..b3976e5512 100644
--- a/sympy/series/limits.py
+++ b/sympy/series/limits.py
@@ -338,7 +338,7 @@ def set_signs(expr):
                     return r
             try:
                 coeff = newe.as_leading_term(z, cdir=cdir)
-                if coeff != newe and coeff.has(exp):
+                if coeff != newe and (coeff.has(exp) or coeff.has(S.Exp1)):
                     return gruntz(coeff, z, 0, "-" if re(cdir).is_negative else "+")
             except (ValueError, NotImplementedError, PoleError):
                 pass
diff --git a/sympy/tensor/indexed.py b/sympy/tensor/indexed.py
index 8be0bd902b..ff372ac655 100644
--- a/sympy/tensor/indexed.py
+++ b/sympy/tensor/indexed.py
@@ -139,6 +139,7 @@ class Indexed(Expr):
     True
 
     """
+    is_commutative = True
     is_Indexed = True
     is_symbol = True
     is_Atom = True


Test patch:
diff --git a/sympy/core/tests/test_args.py b/sympy/core/tests/test_args.py
index 7e3b28f175..6e5ab8fdd0 100644
--- a/sympy/core/tests/test_args.py
+++ b/sympy/core/tests/test_args.py
@@ -2014,11 +2014,6 @@ def test_sympy__functions__combinatorial__numbers__carmichael():
     assert _test_args(carmichael(x))
 
 
-def test_sympy__functions__combinatorial__numbers__mobius():
-    from sympy.functions.combinatorial.numbers import mobius
-    assert _test_args(mobius(2))
-
-
 def test_sympy__functions__combinatorial__numbers__motzkin():
     from sympy.functions.combinatorial.numbers import motzkin
     assert _test_args(motzkin(5))
@@ -5009,6 +5004,11 @@ def test_sympy__ntheory__factor___primeomega():
     assert _test_args(t)
 
 
+def test_sympy__ntheory__residue_ntheory__mobius():
+    from sympy.ntheory import mobius
+    assert _test_args(mobius(2))
+
+
 def test_sympy__ntheory__generate__primepi():
     from sympy.ntheory import primepi
     n = symbols('n')
diff --git a/sympy/functions/combinatorial/tests/test_comb_numbers.py b/sympy/functions/combinatorial/tests/test_comb_numbers.py
index bfcb31d5fb..37f08011d6 100644
--- a/sympy/functions/combinatorial/tests/test_comb_numbers.py
+++ b/sympy/functions/combinatorial/tests/test_comb_numbers.py
@@ -15,7 +15,7 @@
 from sympy.series.order import O
 from sympy.functions import (
     bernoulli, harmonic, bell, fibonacci, tribonacci, lucas, euler, catalan,
-    genocchi, andre, partition, mobius, motzkin, binomial, gamma, sqrt, cbrt, hyper, log, digamma,
+    genocchi, andre, partition, motzkin, binomial, gamma, sqrt, cbrt, hyper, log, digamma,
     trigamma, polygamma, factorial, sin, cos, cot, polylog, zeta, dirichlet_eta)
 from sympy.functions.combinatorial.numbers import _nT
 
@@ -580,48 +580,6 @@ def test_partition():
     raises(ValueError, lambda: partition(Rational(5, 4)))
 
 
-def test_mobius():
-    # error
-    m = Symbol('m', integer=False)
-    raises(TypeError, lambda: mobius(m))
-    raises(TypeError, lambda: mobius(4.5))
-    m = Symbol('m', positive=False)
-    raises(ValueError, lambda: mobius(m))
-    raises(ValueError, lambda: mobius(-3))
-
-    # special case
-    p = Symbol('p', prime=True)
-    assert mobius(p) == -1
-
-    # property
-    n = Symbol('n', integer=True, positive=True)
-    assert mobius(n).is_integer is True
-    assert mobius(n).is_prime is False
-
-    # symbolic
-    n = Symbol('n', integer=True, positive=True)
-    k = Symbol('k', integer=True, positive=True)
-    assert mobius(n**2) == 0
-    assert mobius(4*n) == 0
-    assert isinstance(mobius(n**k), mobius)
-    assert mobius(n**(k+1)) == 0
-    assert isinstance(mobius(3**k), mobius)
-    assert mobius(3**(k+1)) == 0
-    m = Symbol('m')
-    assert isinstance(mobius(4*m), mobius)
-
-    # Integer
-    assert mobius(13*7) == 1
-    assert mobius(1) == 1
-    assert mobius(13*7*5) == -1
-    assert mobius(13**2) == 0
-    A008683 = [1, -1, -1, 0, -1, 1, -1, 0, 0, 1, -1, 0, -1, 1, 1, 0, -1, 0,
-               -1, 0, 1, 1, -1, 0, 0, 1, 0, 0, -1, -1, -1, 0, 1, 1, 1, 0, -1,
-               1, 1, 0, -1, -1, -1, 0, 0, 1, -1, 0, 0, 0, 1, 0, -1, 0, 1, 0]
-    for n, val in enumerate(A008683, 1):
-        assert mobius(n) == val
-
-
 def test__nT():
        assert [_nT(i, j) for i in range(5) for j in range(i + 2)] == [
     1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 2, 1, 1, 0]
diff --git a/sympy/ntheory/tests/test_generate.py b/sympy/ntheory/tests/test_generate.py
index 20b5222a83..e487b89686 100644
--- a/sympy/ntheory/tests/test_generate.py
+++ b/sympy/ntheory/tests/test_generate.py
@@ -3,11 +3,10 @@
 from sympy.core.numbers import (I, Rational, nan, zoo)
 from sympy.core.singleton import S
 from sympy.core.symbol import Symbol
-from sympy.functions.combinatorial.numbers import mobius
 from sympy.ntheory.generate import (sieve, Sieve)
 from sympy.series.limits import limit
 
-from sympy.ntheory import isprime, totient, randprime, nextprime, prevprime, \
+from sympy.ntheory import isprime, totient, mobius, randprime, nextprime, prevprime, \
     primerange, primepi, prime, primorial, composite, compositepi, reduced_totient
 from sympy.ntheory.generate import cycle_length
 from sympy.ntheory.primetest import mr
diff --git a/sympy/ntheory/tests/test_residue.py b/sympy/ntheory/tests/test_residue.py
index 7651b8fecc..9a0df2b31e 100644
--- a/sympy/ntheory/tests/test_residue.py
+++ b/sympy/ntheory/tests/test_residue.py
@@ -278,8 +278,19 @@ def test_residue():
     assert kronecker_symbol(1, 0) == kronecker_symbol(-1, 0) == 1
     assert kronecker_symbol(0, 0) == 0
 
+    assert mobius(13*7) == 1
+    assert mobius(1) == 1
+    assert mobius(13*7*5) == -1
+    assert mobius(13**2) == 0
+    raises(ValueError, lambda: mobius(-3))
+
+    p = Symbol('p', integer=True, positive=True, prime=True)
     x = Symbol('x', positive=True)
     i = Symbol('i', integer=True)
+    assert mobius(p) == -1
+    raises(TypeError, lambda: mobius(x))
+    raises(ValueError, lambda: mobius(i))
+
     assert _discrete_log_trial_mul(587, 2**7, 2) == 7
     assert _discrete_log_trial_mul(941, 7**18, 7) == 18
     assert _discrete_log_trial_mul(389, 3**81, 3) == 81
@@ -362,10 +373,3 @@ def test_binomial_p_pow():
     for _ in range(trials):
         m, prime, power = randint(0, n), choice(primes), randint(1, 10)
         assert _binomial_mod_prime_power(n, m, prime, power) == binomials[m] % prime**power
-
-
-def test_deprecated_ntheory_symbolic_functions():
-    from sympy.testing.pytest import warns_deprecated_sympy
-
-    with warns_deprecated_sympy():
-        assert mobius(3) == -1
diff --git a/sympy/printing/tests/test_latex.py b/sympy/printing/tests/test_latex.py
index 42a986f413..e33da35f87 100644
--- a/sympy/printing/tests/test_latex.py
+++ b/sympy/printing/tests/test_latex.py
@@ -16,7 +16,7 @@
 from sympy.core.singleton import S
 from sympy.core.symbol import (Symbol, Wild, symbols)
 from sympy.functions.combinatorial.factorials import (FallingFactorial, RisingFactorial, binomial, factorial, factorial2, subfactorial)
-from sympy.functions.combinatorial.numbers import bernoulli, bell, catalan, euler, genocchi, lucas, fibonacci, tribonacci, mobius
+from sympy.functions.combinatorial.numbers import bernoulli, bell, catalan, euler, genocchi, lucas, fibonacci, tribonacci
 from sympy.functions.elementary.complexes import (Abs, arg, conjugate, im, polar_lift, re)
 from sympy.functions.elementary.exponential import (LambertW, exp, log)
 from sympy.functions.elementary.hyperbolic import (asinh, coth)
@@ -1805,8 +1805,6 @@ def test_latex_numbers():
     assert latex(tribonacci(n, x)) == r"T_{n}\left(x\right)"
     assert latex(tribonacci(n)**2) == r"T_{n}^{2}"
     assert latex(tribonacci(n, x)**2) == r"T_{n}^{2}\left(x\right)"
-    assert latex(mobius(n)) == r"\mu\left(n\right)"
-    assert latex(mobius(n)**2) == r"\mu^{2}\left(n\right)"
 
 
 def test_latex_euler():
diff --git a/sympy/series/tests/test_limits.py b/sympy/series/tests/test_limits.py
index 8767aa88f3..245393b9a7 100644
--- a/sympy/series/tests/test_limits.py
+++ b/sympy/series/tests/test_limits.py
@@ -1398,3 +1398,7 @@ def test_issue_25847():
     assert limit(acsch(sin(x)/x), x, 0, '+-') == log(1 + sqrt(2))
     assert limit(acsch(exp(1/x)), x, 0, '+') == 0
     assert limit(acsch(exp(1/x)), x, 0, '-') == oo
+
+
+def test_issue_26040():
+    assert limit(besseli(0, x + 1)/besseli(0, x), x, oo) == S.Exp1
diff --git a/sympy/sets/tests/test_sets.py b/sympy/sets/tests/test_sets.py
index 657ab19a90..9772ce08d1 100644
--- a/sympy/sets/tests/test_sets.py
+++ b/sympy/sets/tests/test_sets.py
@@ -1737,17 +1737,3 @@ def test_issue_20379():
 def test_finiteset_simplify():
     S = FiniteSet(1, cos(1)**2 + sin(1)**2)
     assert S.simplify() == {1}
-
-def test_issue_14336():
-    #https://github.com/sympy/sympy/issues/14336
-    U = S.Complexes
-    x = Symbol("x")
-    U -= U.intersect(Ne(x, 1).as_set())
-    U -= U.intersect(S.true.as_set())
-
-def test_issue_9855():
-    #https://github.com/sympy/sympy/issues/9855
-    x, y, z = symbols('x, y, z', real=True)
-    s1 = Interval(1, x) & Interval(y, 2)
-    s2 = Interval(1, 2)
-    assert s1.is_subset(s2) == None
diff --git a/sympy/tensor/tests/test_indexed.py b/sympy/tensor/tests/test_indexed.py
index c0b2696827..0dc5376387 100644
--- a/sympy/tensor/tests/test_indexed.py
+++ b/sympy/tensor/tests/test_indexed.py
@@ -501,9 +501,3 @@ def test_complicated_derivative_with_Indexed():
             ((x[i] - y[i])**2/sigma,)
         )/sigma**2
     )
-
-
-def test_IndexedBase_commutative():
-    t = IndexedBase('t', commutative=False)
-    u = IndexedBase('u', commutative=False)
-    assert t[0]*u[0] != u[0]*t[0]