cp's OEIS Frontend

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.

A254732 a(n) is the least k > n such that n divides k^2.

This page as a plain text file.
%I A254732 #38 Aug 07 2025 16:03:46
%S A254732 2,4,6,6,10,12,14,12,12,20,22,18,26,28,30,20,34,24,38,30,42,44,46,36,
%T A254732 30,52,36,42,58,60,62,40,66,68,70,42,74,76,78,60,82,84,86,66,60,92,94,
%U A254732 60,56,60,102,78,106,72,110,84,114,116,118,90,122,124,84,72
%N A254732 a(n) is the least k > n such that n divides k^2.
%C A254732 A073353(n) <= a(n) <= 2*n. Any prime that divides n must also divide a(n), and because n divides (2*n)^2.
%C A254732 Are all terms even? -_Harvey P. Dale_, Aug 07 2025
%H A254732 Peter Kagey, <a href="/A254732/b254732.txt">Table of n, a(n) for n = 1..5000</a>
%F A254732 a(n) = sqrt(n*A072905(n)).
%F A254732 a(n) = A019554(n)*(A000188(n)+1).
%F A254732 Sum_{k=1..n} a(k) ~ c * n^2 / 2, where c = 1 + zeta(3)/zeta(2) = 1 + A253905 = 1.73076296940143849872... . - _Amiram Eldar_, Feb 17 2024
%e A254732 a(12) = 18 because 12 divides 18^2, but 12 does not divide 13^2, 14^2, 15^2, 16^2, or 17^2.
%t A254732 lk[n_]:=Module[{k=n+1},While[!Divisible[k^2,n],k++];k]; Array[lk,70] (* _Harvey P. Dale_, Nov 05 2017 *)
%t A254732 Table[Module[{k=n+1},While[PowerMod[k,2,n]!=0,k++];k],{n,70}] (* _Harvey P. Dale_, Aug 07 2025 *)
%o A254732 (Ruby)
%o A254732 def a(n)
%o A254732   (n+1..2*n).find { |k| k**2 % n == 0 }
%o A254732 end
%o A254732 (PARI)
%o A254732 a(n)=for(k=n+1,2*n,if(k^2%n==0,return(k)))
%o A254732 vector(100,n,a(n)) \\ _Derek Orr_, Feb 06 2015
%o A254732 (PARI) a(n)=my(t=factorback(factor(n)[,1])); forstep(k=n+t,2*n,t,if(k^2%n==0, return(k))) \\ _Charles R Greathouse IV_, Feb 07 2015
%o A254732 (Haskell)
%o A254732 a254732 n = head [k | k <- [n + 1 ..], mod (k ^ 2) n == 0]
%o A254732 -- _Reinhard Zumkeller_, Feb 07 2015
%o A254732 (Python)
%o A254732 def A254732(n):
%o A254732     k = n + 1
%o A254732     while pow(k,2,n):
%o A254732         k += 1
%o A254732     return k # _Chai Wah Wu_, Feb 15 2015
%Y A254732 Cf. A254733 (similar, with k^3), A254734 (similar, with k^4), A073353 (similar, with limit m->infinity of k^m).
%Y A254732 Cf. A253905.
%K A254732 nonn,easy
%O A254732 1,1
%A A254732 _Peter Kagey_, Feb 06 2015