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.

A019460 Add 1, multiply by 1, add 2, multiply by 2, etc., start with 2.

This page as a plain text file.
%I A019460 #63 Mar 09 2021 19:11:59
%S A019460 2,3,3,5,10,13,39,43,172,177,885,891,5346,5353,37471,37479,299832,
%T A019460 299841,2698569,2698579,26985790,26985801,296843811,296843823,
%U A019460 3562125876,3562125889,46307636557,46307636571,648306911994,648306912009,9724603680135,9724603680151,155593658882416
%N A019460 Add 1, multiply by 1, add 2, multiply by 2, etc., start with 2.
%C A019460 After a(7) = 43, the next prime in the sequence is a(649) with 676 digits. - _M. F. Hasler_, Jan 12 2011
%D A019460 New York Times, Oct 13, 1996.
%H A019460 Ivan Panchenko, <a href="/A019460/b019460.txt">Table of n, a(n) for n = 0..200</a>
%H A019460 Nick Hobson, <a href="/A019460/a019460.py.txt">Python program for this sequence</a>
%F A019460 a(2n) = 2*(A000522(n) + n!) - n - 2.
%F A019460 a(2n+1) = 2*(A000522(n) + n!) - 1.
%F A019460 Recursive: a(0) = 2, a(n) = (1 + floor((n-1)/2) - ceiling((n-1)/2))*(a(n-1) + (n+2)/2) + (ceiling((n-1)/2) - floor((n-1)/2))*(n/2)*a(n-1). - _Wesley Ivan Hurt_, Jan 12 2013
%t A019460 a[n_] := If[ OddQ@n, a[n - 1] + (n + 1)/2, a[n - 1]*n/2]; a[0] = 2; Table[ a@n, {n, 0, 28}] (* _Robert G. Wilson v_, Jul 21 2009 *)
%o A019460 (PARI) A019460(n)=2*(A000522(n\2)+(n\2)!)-if(bittest(n,0),1,n\2+2)
%o A019460 /* For producing the terms in increasing order, the following 'hack' can be used _M. F. Hasler_, Jan 12 2011 */
%o A019460 lastn=0; an1=1; A000522(n)={ an1=if(n, n==lastn && return(an1); n==lastn+1||error(); an1*lastn=n)+1 }
%o A019460 (Python)
%o A019460 l=[2]
%o A019460 for n in range(1, 101):
%o A019460     l.append(l[n - 1] + ((n + 1)//2) if n%2 else l[n - 1]*(n//2))
%o A019460 print(l) # _Indranil Ghosh_, Jul 05 2017
%Y A019460 Cf. A019461 (same, but start with 0), A019463 (start with 1), A019462 (start with 3), A082448 (start with 4).
%Y A019460 Cf. A082458, A019464, A019465, A019466 (similar, but first multiply, then add; starting with 0,1,2,3).
%K A019460 nonn,easy
%O A019460 0,1
%A A019460 _N. J. A. Sloane_
%E A019460 One more term from _Robert G. Wilson v_, Jul 21 2009
%E A019460 Formula provided by _Nathaniel Johnston_, Nov 11 2010
%E A019460 Formula double-checked and PARI code added by _M. F. Hasler_, Nov 12 2010
%E A019460 Edited by _M. F. Hasler_, Feb 25 2018