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 A194627 #32 Nov 11 2024 07:27:01 %S A194627 1,2,3,6,9,14,21,30,41,46,59,66,81,98,117,138,161,186,213,242,273,306, %T A194627 341,378,417,458,501,546,593,602,651,702,755,810,867,926,987,1050, %U A194627 1115,1182,1251,1322,1395,1470,1547,1626,1707,1790,1875,1962,2051,2142 %N A194627 a(1)=1, a(n+1) = p(n)^2 + q(n)^2 + 1, where p(n) and q(n) are the number of prime and nonprime numbers respectively in the sequence so far. %H A194627 Robert Israel, <a href="/A194627/b194627.txt">Table of n, a(n) for n = 1..10000</a> %e A194627 For n=1, we have no primes and one nonprime (a(1)=1), so a(2)=0^2+1^2+1=2. Now we have one prime (a(2)=2) and one nonprime, so a(3)=1^2+1^2+1=3. %p A194627 R:= 1: v:= 1: p:= 0: q:= 0: %p A194627 for i from 2 to 100 do %p A194627 if isprime(v) then p:= p+1 else q:= q+1 fi; %p A194627 v:= p^2 + q^2 + 1; %p A194627 R:= R,v %p A194627 od: %p A194627 R; # _Robert Israel_, Nov 10 2024 %t A194627 t = {1}; Do[ps = Count[t, _?(PrimeQ[#] &)]; AppendTo[t, ps^2 + (n - ps - 1)^2 + 1], {n, 2, 100}]; t (* _T. D. Noe_, Sep 15 2011 *) %o A194627 (PARI) p=q=0;for(n=1,50,print1(k=p^2+q^2+1", ");if(isprime(k),p++,q++)) \\ _Charles R Greathouse IV_, Sep 16 2011 %Y A194627 Cf. A079545, A377791, A377882. %K A194627 nonn,easy %O A194627 1,2 %A A194627 _Greg Knowles_, Sep 15 2011