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.

A118478 a(n) is the smallest m such that m*(m+1) is divisible by the first n prime numbers.

This page as a plain text file.
%I A118478 #32 May 31 2022 10:59:47
%S A118478 1,2,5,14,209,714,714,62985,367080,728364,64822394,1306238010,
%T A118478 11182598504,715041747420,51913478860880,454746157008780,
%U A118478 9314160363311804,261062105979210899,261062105979210899,696537082207206753590,54097844397380813592485,286495021083846822067820
%N A118478 a(n) is the smallest m such that m*(m+1) is divisible by the first n prime numbers.
%C A118478 a(n)*(a(n)+1)/(product of first n primes) = 1, 1, 1, 1, 19, 17, 1, 409, 604, 82, 20951, 229931, 411012, 39080794, 4382914408, ... - _Robert G. Wilson v_, May 13 2006 [This is now A215021. - _N. J. A. Sloane_, Aug 02 2012]
%H A118478 Jinyuan Wang, <a href="/A118478/b118478.txt">Table of n, a(n) for n = 1..30</a> (terms 1..25 from Robert Gerbicz)
%F A118478 a(n) = Min_{m | m*(m+1) is divisible by A002110(n)}.
%e A118478 a(8) = 62985 since 62985*62986 = 2*3*5*7*11*13*17*19*409, i.e., it is divisible by the first 8 prime numbers (2,3,..,19).
%t A118478 f[n_] := Block[{k = 1, p = Times @@ Prime@Range@n}, While[ !IntegerQ@ Sqrt[4k*p + 1], k++ ]; Floor@ Sqrt[k*p]]; Array[f, 15] (* _Robert G. Wilson v_, May 13 2006 *)
%o A118478 (PARI) P=primes(25);T=1;for(n=1,25,T*=P[n];m=T;for(k=2^(n-1),2^n-1,u=binary(k); a=1;for(i=1,n,if(u[i],a*=P[i]));b=T/a;w=bezout(a,b);if(w[1]<=0,w[1]+=b); c=a*w[1]-1;m=min(m,c);w[1]=b-w[1];if(w[1]<=0,w[1]+=b);c=a*w[1];m=min(m,c)); print1(m,",")) \\ _Robert Gerbicz_, Aug 24 2006
%o A118478 (Haskell)
%o A118478 import Data.List (elemIndex); import Data.Maybe (fromJust)
%o A118478 a118478 n = (+ 1) . fromJust $ elemIndex 0 $
%o A118478             map (flip mod (a002110 n)) $ tail a002378_list
%o A118478 -- _Reinhard Zumkeller_, Jun 14 2015
%o A118478 (Python 3.8+)
%o A118478 from itertools import combinations
%o A118478 from math import prod
%o A118478 from sympy import sieve, prime, primorial
%o A118478 from sympy.ntheory.modular import crt
%o A118478 def A118478(n): return 1 if n == 1 else int(min(min(crt((m, (k:=primorial(n))//m), (0, -1))[0], crt((k//m, m), (0, -1))[0]) for m in (prod(d) for l in range(1, n//2+1) for d in combinations(sieve.primerange(prime(n)+1), l)))) # _Chai Wah Wu_, May 31 2022
%Y A118478 Cf. A002110, A002378, A193314, A215021, A053670, A059958.
%K A118478 nonn
%O A118478 1,2
%A A118478 _Giovanni Resta_, May 05 2006
%E A118478 More terms from _Robert Gerbicz_, Aug 24 2006