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.

A346180 a(n) = prime(n) + n if n is prime, a(n) = prime(n) otherwise.

This page as a plain text file.
%I A346180 #19 Nov 20 2022 11:17:41
%S A346180 2,5,8,7,16,13,24,19,23,29,42,37,54,43,47,53,76,61,86,71,73,79,106,89,
%T A346180 97,101,103,107,138,113,158,131,137,139,149,151,194,163,167,173,220,
%U A346180 181,234,193,197,199,258,223,227,229,233,239,294,251,257,263,269,271
%N A346180 a(n) = prime(n) + n if n is prime, a(n) = prime(n) otherwise.
%C A346180 For n > 0, take the n-th prime and only add n to it if n is prime itself.
%F A346180 a(n) = A000040(n) + A061397(n).
%e A346180 a(1) = 2 = 2+0; 2 is the first prime. 1 is not prime and thus is not added.
%e A346180 a(2) = 5 = 3+2; 3 is the second prime, and since 2 is also prime, add 2.
%e A346180 a(3) = 8 = 5+3; 5 is the third prime, and since 3 is also prime, add 3.
%t A346180 Table[Prime@n+Boole@PrimeQ[n]n,{n,60}] (* _Giorgos Kalogeropoulos_, Jul 29 2021 *)
%t A346180 Table[If[PrimeQ[n],Prime[n]+n,Prime[n]],{n,60}] (* _Harvey P. Dale_, Nov 20 2022 *)
%o A346180 (PARI) a(n) = prime(n) + isprime(n)*n; \\ _Michel Marcus_, Jul 12 2021
%o A346180 (Python)
%o A346180 from sympy import isprime, prime
%o A346180 def a(n): return prime(n) + n*isprime(n)
%o A346180 print([a(n) for n in range(1, 59)]) # _Michael S. Branicky_, Jul 29 2021
%o A346180 (Python) # faster version for initial segment of sequence
%o A346180 from sympy import isprime, prime, primerange
%o A346180 def aupton(nn): return [p + n*isprime(n) for n, p in enumerate(primerange(1, prime(nn)+1), start=1)]
%o A346180 print(aupton(10000)) # _Michael S. Branicky_, Jul 29 2021
%Y A346180 Cf. A000040, A061397.
%K A346180 nonn
%O A346180 1,1
%A A346180 _Samuel Vilz_, Jul 09 2021