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.

A089026 a(n) = n if n is a prime, otherwise a(n) = 1.

This page as a plain text file.
%I A089026 #126 Jun 21 2025 12:02:01
%S A089026 1,2,3,1,5,1,7,1,1,1,11,1,13,1,1,1,17,1,19,1,1,1,23,1,1,1,1,1,29,1,31,
%T A089026 1,1,1,1,1,37,1,1,1,41,1,43,1,1,1,47,1,1,1,1,1,53,1,1,1,1,1,59,1,61,1,
%U A089026 1,1,1,1,67,1,1,1,71,1,73,1,1,1,1,1,79,1,1,1,83,1,1,1,1,1,89,1,1,1,1,1,1,1
%N A089026 a(n) = n if n is a prime, otherwise a(n) = 1.
%C A089026 This sequence was the subject of the 1st problem of the 9th Irish Mathematical Olympiad 1996 with gcd((n + 1)!, n! + 1) = a(n+1) for n >= 0 (see formula Jan 23 2009 and link). - _Bernard Schott_, Jul 22 2020
%C A089026 For sequence A with terms a(1), a(2), a(3),... , let R(0) = 1 and for k >= 1 let  R(k) = rad(a(1)*a(2)*...*a(k)). Define the Rad-transform of A to be R(n)/R(n-1); n >= 1, where rad is A007947.  Then this sequence is the Rad transform of the positive integers, A = A000027. - _David James Sycamore_, Apr 19 2024
%D A089026 Paulo Ribenboim, The little book of big primes, Springer 1991, p. 106.
%D A089026 L. Tesler, "Factorials and Primes", Math. Bulletin of the Bronx H.S. of Science (1961), 5-10. [From Larry Tesler (tesler(AT)pobox.com), Nov 08 2010]
%H A089026 G. C. Greubel, <a href="/A089026/b089026.txt">Table of n, a(n) for n = 1..5000</a>
%H A089026 The IMO Compendium, <a href="https://imomath.com/othercomp/Ire/IreMO96.pdf">Problem 1</a>, 9th Irish Mathematical Olympiad 1996.
%H A089026 <a href="/index/O#Olympiads">Index to sequences related to Olympiads</a>.
%F A089026 From _Peter Luschny_, Nov 29 2003: (Start)
%F A089026 a(n) = denominator(n! * Sum_{m=0..n} (-1)^m*m!*Stirling2(n+1, m+1)/(m+1)).
%F A089026 a(n) = denominator(n! * Sum_{m=0..n} (-1)^m*m!*Stirling2(n, m)/(m+1)). (End)
%F A089026 From _Alexander Adamchuk_, May 20 2006: (Start)
%F A089026 a(n) = numerator((n/2)/(n-1)!) + floor(2/n) - 2*floor(1/n).
%F A089026 a(n) = A090585(n-1) = A000217(n-1)/A069268(n-1) for n>2. (End)
%F A089026 a(n) = gcd(n,(n-1)!+1). - _Jaume Oliver Lafont_, Jul 17 2008, Jan 23 2009
%F A089026 a(1) = 1, a(2) = 2, then a(n) = 1 or a(n) = n = prime(m) = (Product q+k, k = 1 .. 2*floor(n/2+1)-q) / (Product prime(i)^(Sum (floor((n+1)/(prime(i)^w)) - floor(q/(prime(i)^w)) ), w = 1 .. floor(log[base prime(i)] n+1) ), i = 2 .. m-1) where q = prime(m-1). -  Larry Tesler (tesler(AT)pobox.com), Nov 08 2010
%F A089026 a(n) = (n!*HarmonicNumber(n) mod n)+1, n != 4. - _Gary Detlefs_, Dec 03 2011
%F A089026 a(n) = denominator of (n!)/n^(3/2). - _Arkadiusz Wesolowski_, Dec 04 2011
%F A089026 a(n) = A034386(n+1)/A034386(n). - _Eric Desbiaux_, May 10 2013
%F A089026 a(n) = n^c(n), where c = A010051. - _Wesley Ivan Hurt_, Jun 16 2013
%F A089026 a(n) = A014963(n)^(-A008683(n)). - _Mats Granvik_, Jul 02 2016
%F A089026 Conjecture: for n > 3, a(n) = gcd(n, A007406(n-1)). - _Thomas Ordowski_, Aug 02 2019
%F A089026 a(n) = 1 + c(n)*(n-1), where c = A010051. - _Wesley Ivan Hurt_, Jun 21 2025
%e A089026 From Larry Tesler (tesler(AT)pobox.com), Nov 08 2010: (Start)
%e A089026 a(9) = (8*9*10)/(2^((5+2+1)-(3+1+0))*3^((3+1)-(2+0))*5^((2)-(1))*7^((1)-(1))) = 1 [composite].
%e A089026 a(10) = (8*9*10)/(2^((5+2+1)-(3+1+0))*3^((3+1)-(2+0))*5^((2)-(1))*7^((1)-(1))) = 1 [composite].
%e A089026 a(11) = (8*9*10*11*12)/(2^((6+3+1)-(3+1+0))*3^((4+1)-(2+0))*5^((2)-(1))*7^((1)-(1))) = 11 [prime]. (End)
%t A089026 digits=200; a=Table[If[PrimePi[n]-PrimePi[n-1]>0, n, 1], {n, 1, digits}]; Table[Numerator[(n/2)/(n-1)! ] + Floor[2/n] - 2*Floor[1/n], {n,1,200}] (* _Alexander Adamchuk_, May 20 2006 *)
%t A089026 Range@ 120 /. k_ /; CompositeQ@ k -> 1 (* or *)
%t A089026 Table[n Boole@ PrimeQ@ n, {n, 120}] /. 0 -> 1 (* or *)
%t A089026 Table[If[PrimeQ@ n, n, 1], {n, 120}] (* _Michael De Vlieger_, Jul 02 2016 *)
%o A089026 (Sage)
%o A089026 def A089026(n):
%o A089026     if n == 4: return 1
%o A089026     f = factorial(n-1)
%o A089026     return (f + 1) - n*(f//n)
%o A089026 [A089026(n) for n in (1..96)]   # _Peter Luschny_, Oct 16 2013
%o A089026 (Magma) [IsPrime(n) select n else 1: n in [1..96]]; // _Marius A. Burtea_, Aug 02 2019
%o A089026 (Python)
%o A089026 from sympy import isprime
%o A089026 def a(n): return n if isprime(n) else 1
%o A089026 print([a(n) for n in range(1, 97)]) # _Michael S. Branicky_, Oct 06 2022
%o A089026 (MATLAB) a = [1:96]; a(isprime(a) == false) = 1; % _Thomas Scheuerle_, Oct 06 2022
%o A089026 (PARI) a(n) = n^isprime(n) \\ _David A. Corneth_, Oct 06 2022
%Y A089026 Differs from A080305 at n=30.
%Y A089026 Cf. A090585, A000217, A069268, A090586, A007619, A007406.
%Y A089026 Cf. A061397, A135683.
%Y A089026 Cf. A000027, A007947.
%K A089026 nonn
%O A089026 1,2
%A A089026 _Roger L. Bagula_, Nov 12 2003