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.

A340008 a(n) is the image of n under the map: n -> n/2 if n is even, n-> n^2 - 1 if n is an odd prime, otherwise n -> n - 1.

This page as a plain text file.
%I A340008 #15 Jan 05 2021 21:44:51
%S A340008 0,1,8,2,24,3,48,4,8,5,120,6,168,7,14,8,288,9,360,10,20,11,528,12,24,
%T A340008 13,26,14,840,15,960,16,32,17,34,18,1368,19,38,20,1680,21,1848,22,44,
%U A340008 23,2208,24,48,25,50,26,2808,27,54,28,56,29,3480,30,3720,31,62,32
%N A340008 a(n) is the image of n under the map: n -> n/2 if n is even, n-> n^2 - 1 if n is an odd prime, otherwise n -> n - 1.
%C A340008 This map is used in A339991.
%t A340008 Array[Which[EvenQ@ #, #/2, PrimeQ@ #, #^2 - 1, True, # - 1] &, 64] (* _Michael De Vlieger_, Dec 28 2020 *)
%o A340008 (Python)
%o A340008 from sympy import isprime
%o A340008 for n in range(1, 1001):
%o A340008     if n%2 == 0: a = n/2
%o A340008     elif isprime(n) == 1: a = n*n - 1
%o A340008     else: a = n - 1
%o A340008     print(a)
%o A340008 (PARI) a(n) = if (n%2, if (isprime(n), n^2-1, n-1), n/2); \\ _Michel Marcus_, Dec 26 2020
%Y A340008 Cf. A339991.
%K A340008 nonn
%O A340008 1,3
%A A340008 _Ya-Ping Lu_, Dec 26 2020