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.
%I A341475 #22 Oct 03 2023 01:32:54 %S A341475 12,18,24,30,36,40,48,54,56,66,80,84,90,96,112,126,132,156,176,198, %T A341475 200,208,220,270,280,304,352,364,380,448,550,570,594,690,736,882,910, %U A341475 918,928,945,992,1026,1040,1120,1216,1372,1376,1488,1638,1696,1722,1782 %N A341475 2-near-perfect numbers. %C A341475 A number n is k-near-perfect if n is the sum of all but k of the proper divisors of n. Perfect numbers are 0-near-perfect and sequence A181595 lists the 1-near-perfect numbers. %H A341475 Michael S. Branicky, <a href="/A341475/b341475.txt">Table of n, a(n) for n = 1..2000</a> %H A341475 Vedant Aryan, Dev Madhavani, Savan Parikh, Ingrid Slattery, and Joshua Zelinsky, <a href="https://arxiv.org/abs/2310.01305">On 2-Near Perfect Numbers</a>, arXiv:2310.01305 [math.NT], 2023. %H A341475 Hùng Việt Chu, <a href="https://cs.uwaterloo.ca/journals/JIS/VOL24/Chu/chu26.html">Divisibility of Divisor Functions of Even Perfect Numbers</a>, J. Int. Seq., Vol. 24 (2021), Article 21.3.4. %H A341475 Paul Pollack and Vladimir Shevelev, <a href="https://doi.org/10.1016/j.jnt.2012.06.008">On perfect and near-perfect numbers</a>, J. Number Theory 132 (2012), pp. 3037-3046; also on <a href="http://arxiv.org/abs/1011.6160">arXiv</a>, arXiv:1011.6160 [math.NT], 2010-2012. %e A341475 48 is 2-near-perfect because its proper divisors are {1, 2, 3, 4, 6, 8, 12, 16, 24} and 48 = 1+2+3+4+6+8+24. %o A341475 (Python) %o A341475 from sympy import divisors %o A341475 def ok(n): %o A341475 proper_divs = divisors(n)[:-1] %o A341475 s = sum(proper_divs) %o A341475 if s - 3 < n: return False %o A341475 if s - sum(proper_divs[-2:]) > n: return False %o A341475 for i, c1 in enumerate(proper_divs[:-1]): %o A341475 if s - c1 - proper_divs[i+1] < n: return False %o A341475 if s - c1 - n in proper_divs[i+1:]: return True %o A341475 return False %o A341475 def aupto(limit): return [m for m in range(1, limit+1) if ok(m)] %o A341475 print(aupto(1782)) # _Michael S. Branicky_, Feb 21 2021 %Y A341475 Cf. A000396, A181595. %K A341475 nonn %O A341475 1,1 %A A341475 _Jeffrey Shallit_, Feb 13 2021