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 A004648 #41 Aug 01 2025 00:05:10 %S A004648 0,1,2,3,1,1,3,3,5,9,9,1,2,1,2,5,8,7,10,11,10,13,14,17,22,23,22,23,22, %T A004648 23,3,3,5,3,9,7,9,11,11,13,15,13,19,17,17,15,23,31,31,29,29,31,29,35, %U A004648 37,39,41,39,41,41,39,45,55,55,53,53,63,65,2,69,69,71,2,3,4,3 %N A004648 a(n) = prime(n) mod n. %H A004648 N. J. A. Sloane, <a href="/A004648/b004648.txt">Table of n, a(n) for n = 1..10000</a> %H A004648 Labos Elemer, <a href="/A004648/a004648.gif">Graph of first 50000 terms</a> %F A004648 a(n) = prime(n) - n*floor(prime(n)/n) %p A004648 A004648 := proc(n) %p A004648 modp(ithprime(n),n) ; %p A004648 end proc: # _R. J. Mathar_, Dec 02 2014 %t A004648 Table[Mod[Prime[n], n], {n, 100}] (* _Zak Seidov_, Apr 25 2005 *) %o A004648 (PARI) for(n=1,100,print1(prime(n)%n,",")) %o A004648 (Magma) [(NthPrime(n) mod n): n in [1..100]]; // _Vincenzo Librandi_, Apr 06 2011 %o A004648 (Haskell) %o A004648 a004648 n = a004648_list !! (n-1) %o A004648 a004648_list = zipWith mod a000040_list [1..] %o A004648 -- _Reinhard Zumkeller_, Jul 30 2012 %o A004648 (SageMath) %o A004648 def A004648(n): return (nth_prime(n)%n) %o A004648 [A004648(n) for n in range(1,101)] # _G. C. Greubel_, Apr 20 2023 %o A004648 (Python) from sympy import prime; print([prime(i) % i for i in range(1, 101)]) # _Jwalin Bhatt_, Jul 29 2025 %Y A004648 1's occur at A023143, 2's at A023144, 3's at A023145, 4's at A023146, 5's at A023147, 6's at A023148, 7's at A023149, 8's at A023150, 9's at A023151, 10's at A023152, == -1's at A045924. %Y A004648 For records see A127149, A127150. %K A004648 nonn %O A004648 1,3 %A A004648 _N. J. A. Sloane_, Daniel Wild (wild(AT)edumath.u-strasbg.fr) %E A004648 More terms from _Clark Kimberling_ %E A004648 Corrected by _Jaroslav Krizek_, Dec 16 2009