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 A381150 #22 Feb 25 2025 09:44:12 %S A381150 1,2,3,8,5,7,16,9,-7,-30,-23,-39,-16,23,85,62,-23,-131,-370,-239,-347, %T A381150 -802,-455,347,1496,1149,-347,-2190,-1843,347,2884,2537,-347,-3578, %U A381150 -3231,347,4272,3925,-347,-4966,-4619,347,5660,5313,-347,-6354,-6007,-11667,-5660 %N A381150 a(0) = 1, a(1) = 2, a(2) = 3; thereafter, a(n) = a(n-1) + (sum of prior prime terms or whose negatives are prime) - (sum of prior composite terms or whose negatives are composite). %H A381150 Michael De Vlieger, <a href="/A381150/b381150.txt">Table of n, a(n) for n = 0..10003</a> (a(n) for n = 1..1000 from James C. McMahon) %H A381150 Michael De Vlieger, <a href="/A381150/a381150.png">Scatterplot of m*log_10(m*a(n))</a>, n = 1..2^10, where m = 1 of a(n) > 0 (shown in green) and m = -1 if a(n) < 0 (shown in red). %H A381150 Michael De Vlieger, <a href="/A381150/a381150_1.png">Scatterplot of m*log_10(m*a(n))</a>, n = 1..2^16, where m = 1 of a(n) > 0 (shown in green) and m = -1 if a(n) < 0 (shown in red). %e A381150 For n=5, a(5) = 5 + (2 + 3 + 5) - 8 = 7. %e A381150 For n=9, a(9) = -7 + (2 + 3 + 5 + 7 -7) - (8 + 16 + 9) = -7 + 10 - 33 = -30 %p A381150 b:= proc(n) option remember; `if`(n<1, 0, b(n-1)+(t-> %p A381150 `if`(isprime(abs(t)), t, `if`(abs(t)>1, -t, 0)))(a(n))) %p A381150 end: %p A381150 a:= proc(n) option remember; `if`(n<3, n+1, a(n-1)+b(n-1)) end: %p A381150 seq(a(n), n=0..48); # _Alois P. Heinz_, Feb 15 2025 %t A381150 Nest[Append[#,#[[-1]]+Total[Select[#,PrimeQ]]-Total[Select[#,CompositeQ]]]&,{1,2,3},46] %Y A381150 Cf. A000040, A002808, A101135, A119746, A131093, A381149. %K A381150 sign %O A381150 0,2 %A A381150 _James C. McMahon_, Feb 15 2025