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.

A001670 k appears k times (k even).

This page as a plain text file.
%I A001670 #48 May 08 2025 07:22:46
%S A001670 2,2,4,4,4,4,6,6,6,6,6,6,8,8,8,8,8,8,8,8,10,10,10,10,10,10,10,10,10,
%T A001670 10,12,12,12,12,12,12,12,12,12,12,12,12,14,14,14,14,14,14,14,14,14,14,
%U A001670 14,14,14,14,16,16,16,16,16,16,16,16,16,16,16,16,16,16
%N A001670 k appears k times (k even).
%H A001670 Vincenzo Librandi, <a href="/A001670/b001670.txt">Table of n, a(n) for n = 1..10000</a>
%F A001670 a(n) = 2*floor(1/2 + sqrt(n)). - _Antonio Esposito_, Jan 21 2002; corrected by _Branko Curgus_, May 11 2010
%F A001670 With a different offset: g.f. = Sum_{j>=0} 2*x^(j^2+i)/(1-x). - _Ralf Stephan_, Mar 11 2003
%F A001670 From _Branko Curgus_, May 11 2010: (Start)
%F A001670 a(n) = a(n - a(n-2)) + 2; a(1)=2, a(2)=2.
%F A001670 a(n) = 2*round(sqrt(n)). (End)
%F A001670 G.f.: x^(3/4)*theta_2(0,x)/(1-x) where theta_2 is the second Jacobi theta function. - _Robert Israel_, Jan 14 2015
%F A001670 a(n) = 2*floor((sqrt(4*n-3)+1)/2). - _Néstor Jofré_, Apr 24 2017
%p A001670 seq(2*n $ 2*n, n = 1 .. 10); # _Robert Israel_, Jan 14 2015
%t A001670 a[1]=2, a[2]=2, a[n_]:=a[n]=a[n-a[n-2]]+2 (* _Branko Curgus_, May 11 2010 *)
%t A001670 Flatten[Table[Table[n,{n}],{n,2,16,2}]] (* _Harvey P. Dale_, May 31 2012 *)
%o A001670 (Magma) [2*Round(Sqrt(n)): n in [1..70]]; // _Vincenzo Librandi_, Jun 23 2011
%o A001670 (PARI) a(n)=round(sqrt(n))<<1 \\ _Charles R Greathouse IV_, Jun 23 2011
%o A001670 (MATLAB) a = @(n) 2*floor((sqrt(4*n-3)+1)/2); % _Néstor Jofré_, Apr 24 2017
%o A001670 (Python)
%o A001670 from math import isqrt
%o A001670 def A001670(n): return (m:=isqrt(n))+int((n-m*(m+1)<<2)>=1)<<1 # _Chai Wah Wu_, Jul 29 2022
%Y A001670 Cf. A001650, A000194.
%Y A001670 Equals A130829(n) - 1.
%K A001670 nonn,easy
%O A001670 1,1
%A A001670 _N. J. A. Sloane_
%E A001670 Offset changed from 2 to 1 by _Vincenzo Librandi_, Jun 23 2011