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 A097457 #13 Sep 11 2019 22:46:35 %S A097457 2,4,6,7,9,13,12,19,23,29,18,37,21,43,47,53,26,61,28,71,73,79,34,89, %T A097457 97,101,103,107,42,113,45,131,137,139,149,151,52,163,167,173,57,181, %U A097457 60,193,197,199,65,223,227,229,233,239,74,251,257,263,269,271,81,281,84,293 %N A097457 If n is prime replace with the n-th nonprime otherwise replace with the n-th prime. %e A097457 4 is composite so replace it with prime(4) = 7, the 4th entry in the table. %o A097457 (PARI) flipcomppr(n) = { for(x=1,n, if(isprime(x),y=composite(x),y=prime(x)); print1(y",") ) } /* the n-th composite */ composite(n) = { local(c,x); c=1; x=0; while(c <= n, x++; if(!isprime(x),c++); ); return(x) } /* Note: for more efficient code, see A018252 */ %o A097457 (PARI) A097457 = n->if(isprime(n),A018252(n),prime(n)) \\ _M. F. Hasler_, Jan 29 2014 %Y A097457 Cf. A026234. %K A097457 nonn %O A097457 1,1 %A A097457 _Cino Hilliard_, Aug 23 2004 %E A097457 Definition and offset corrected by _M. F. Hasler_, Jan 29 2014