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 A074171 #22 Apr 14 2024 00:19:49 %S A074171 1,3,0,4,9,15,22,30,39,49,60,72,85,99,114,130,147,165,184,204,225,247, %T A074171 270,294,319,345,372,400,429,459,490,522,555,589,624,660,697,735,774, %U A074171 814,855,897,940,984,1029,1075,1122,1170,1219,1269,1320,1372,1425,1479 %N A074171 a(1) = 1. For n >= 2, a(n) is either a(n-1)+n or a(n-1)-n; we use the minus sign only if a(n-1) is prime. E.g., since a(2)=3 is prime, a(3)=a(2)-3=0. %C A074171 In spite of the definition, this is simply 1, 3, then numbers of the form n*(n+7)/2 (A055999). In other words, a(n) = (n-3)*(n+4)/2 for n >= 3. The proof is by induction: For n > 3, a(n-1) = (n-4)*(n+3)/2 is composite, so a(n) = a(n-1) + n = (n-3)*(n+4)/2. - _Dean Hickerson_, _T. D. Noe_, Paul C. Leopardi, _Labos Elemer_ and others, Oct 04 2004 %C A074171 If a 2-set Y and a 3-set Z, having one element in common, are subsets of an n-set X then a(n) is the number of 3-subsets of X intersecting both Y and Z. - _Milan Janjic_, Oct 03 2007 %H A074171 Milan Janjic, <a href="http://www.pmfbl.org/janjic/">Two Enumerative Functions</a>. %F A074171 a(1) = 1, a(2) = 3; a(n+1) = a(n)+n if a(n) is not a prime; a(n+1) = a(n)-n if a(n) is prime. %e A074171 a(1) = 1 %e A074171 a(2) = a(1) + 2 = 3, which is prime, so %e A074171 a(3) = a(2) - 3 = 0, which is not prime, so %e A074171 a(4) = a(3) + 4 = 4, which is not prime, etc. %t A074171 {ta={1, 3}, tb={{0}}};Do[s=Last[ta]; If[PrimeQ[s], ta=Append[ta, s-n]]; If[ !PrimeQ[s], ta=Append[ta, s+n]]; Print[{a=Last[ta], b=(n-3)*(n+4)/2, a-b}]; tb=Append[tb, a-b], {n, 3, 100000}]; {ta, {tb, Union[tb]}} (* _Labos Elemer_, Oct 07 2004 *) %Y A074171 Cf. A074170, A055999. %K A074171 easy,nonn %O A074171 1,2 %A A074171 _Amarnath Murthy_, Aug 30 2002 %E A074171 More terms from _Jason Earls_, Sep 01 2002 %E A074171 More terms from _Labos Elemer_, Oct 07 2004