A085941 Duplicate of A054842.
1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 3, 6, 12, 24, 48, 96, 192, 384, 768, 1536, 9, 18, 36
Offset: 0
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.
a(9) = 23# = 2*3*5*7*11*13*17*19*23 = 223092870 divides the difference 5283234035979900 in the arithmetic progression of 26 primes A204189. - _Jonathan Sondow_, Jan 15 2012
a002110 n = product $ take n a000040_list a002110_list = scanl (*) 1 a000040_list -- Reinhard Zumkeller, Feb 19 2012, May 03 2011
[1] cat [&*[NthPrime(i): i in [1..n]]: n in [1..20]]; // Bruno Berselli, Oct 24 2012
[1] cat [&*PrimesUpTo(p): p in PrimesUpTo(60)]; // Bruno Berselli, Feb 08 2015
A002110 := n -> mul(ithprime(i),i=1..n);
FoldList[Times, 1, Prime[Range[20]]] primorial[n_] := Product[Prime[i], {i, n}]; Array[primorial,20] (* José María Grau Ribas, Feb 15 2010 *) Join[{1}, Denominator[Accumulate[1/Prime[Range[20]]]]] (* Harvey P. Dale, Apr 11 2012 *)
a(n)=prod(i=1,n, prime(i)) \\ Washington Bomfim, Sep 23 2008
p=1; for (n=0, 100, if (n, p*=prime(n)); write("b002110.txt", n, " ", p) ) \\ Harry J. Smith, Nov 13 2009
a(n) = factorback(primes(n)) \\ David A. Corneth, May 06 2018
from sympy import primorial def a(n): return 1 if n < 1 else primorial(n) [a(n) for n in range(51)] # Indranil Ghosh, Mar 29 2017
[sloane.A002110(n) for n in (1..20)] # Giuseppe Coppoletta, Dec 05 2014
; with memoization-macro definec (definec (A002110 n) (if (zero? n) 1 (* (A000040 n) (A002110 (- n 1))))) ;; Antti Karttunen, Aug 30 2016
For n = 24, which has primorial base representation (see A049345) "400" as 24 = 4*A002110(2) + 0*A002110(1) + 0*A002110(0) = 4*6 + 0*2 + 0*1, thus a(24) = prime(3)^4 * prime(2)^0 * prime(1)^0 = 5^4 = 625. For n = 35 = "1021" as 35 = 1*A002110(3) + 0*A002110(2) + 2*A002110(1) + 1*A002110(0) = 1*30 + 0*6 + 2*2 + 1*1, thus a(35) = prime(4)^1 * prime(2)^2 * prime(1) = 7 * 3*3 * 2 = 126.
b = MixedRadix[Reverse@ Prime@ Range@ 12]; Table[Function[k, Times @@ Power @@@ # &@ Transpose@ {Prime@ Range@ Length@ k, Reverse@ k}]@ IntegerDigits[n, b], {n, 0, 51}] (* Michael De Vlieger, Aug 23 2016, Version 10.2 *) f[n_] := Block[{a = {{0, n}}}, Do[AppendTo[a, {First@ #, Last@ #} &@ QuotientRemainder[a[[-1, -1]], Times @@ Prime@ Range[# - i]]], {i, 0, #}] &@ NestWhile[# + 1 &, 0, Times @@ Prime@ Range[# + 1] <= n &]; Rest[a][[All, 1]]]; Table[Times @@ Flatten@ MapIndexed[Prime[#2]^#1 &, Reverse@ f@ n], {n, 0, 73}] (* Michael De Vlieger, Aug 30 2016, Pre-Version 10 *) a[n0_] := Module[{m = 1, i = 1, n = n0, p}, While[n > 0, p = Prime[i]; m *= p^Mod[n, p]; n = Quotient[n, p]; i++]; m]; Table[a[n], {n, 0, 100}] (* Jean-François Alcover, Dec 01 2021, after Antti Karttunen's Sage code *)
A276086(n) = { my(i=0,m=1,pr=1,nextpr); while((n>0),i=i+1; nextpr = prime(i)*pr; if((n%nextpr),m*=(prime(i)^((n%nextpr)/pr));n-=(n%nextpr));pr=nextpr); m; }; \\ Antti Karttunen, May 12 2017
A276086(n) = { my(m=1, p=2); while(n, m *= (p^(n%p)); n = n\p; p = nextprime(1+p)); (m); }; \\ (Better than above one, avoids unnecessary construction of primorials). - Antti Karttunen, Oct 14 2019
from sympy import prime def a(n): i=0 m=pr=1 while n>0: i+=1 N=prime(i)*pr if n%N!=0: m*=(prime(i)**((n%N)/pr)) n-=n%N pr=N return m # Indranil Ghosh, May 12 2017, after Antti Karttunen's PARI code
from sympy import nextprime def a(n): m, p = 1, 2 while n > 0: n, r = divmod(n, p) m *= p**r p = nextprime(p) return m print([a(n) for n in range(74)]) # Peter Luschny, Apr 20 2024
def A276086(n): m=1 i=1 while n>0: p = sloane.A000040(i) m *= (p**(n%p)) n = floor(n/p) i += 1 return (m) # Antti Karttunen, Oct 14 2019, after Indranil Ghosh's Python code above, and my own leaner PARI code from Oct 14 2019. This avoids unnecessary construction of primorials.
(define (A276086 n) (let loop ((n n) (t 1) (i 1)) (if (zero? n) t (let* ((p (A000040 i)) (d (modulo n p))) (loop (/ (- n d) p) (* t (expt p d)) (+ 1 i))))))
(definec (A276086 n) (if (zero? n) 1 (* (expt (A053669 n) (A276088 n)) (A276086 (A276093 n))))) ;; Needs macro definec from http://oeis.org/wiki/Memoization#Scheme
(definec (A276086 n) (if (zero? n) 1 (* (A053669 n) (A276086 (- n (A002110 (A276084 n))))))) ;; Needs macro definec from http://oeis.org/wiki/Memoization#Scheme
5 = 2^2+2^0, e_1 = 2, e_2 = 0, prime(2+1) = prime(3) = 5, prime(0+1) = prime(1) = 2, so a(5) = 5*2 = 10. From _Philippe Deléham_, Jun 03 2015: (Start) This sequence regarded as a triangle withs rows of lengths 1, 1, 2, 4, 8, 16, ...: 1; 2; 3, 6; 5, 10, 15, 30; 7, 14, 21, 42, 35, 70, 105, 210; 11, 22, 33, 66, 55, 110, 165, 330, 77, 154, 231, 462, 385, 770, 1155, 2310; ... (End) From _Peter Munn_, Jun 14 2020: (Start) The initial terms are shown below, equated with the product of their prime factors to exhibit the lexicographic order. We start with 1, since 1 is factored as the empty product and the empty list is first in lexicographic order. n a(n) 0 1 = . 1 2 = 2. 2 3 = 3. 3 6 = 3*2. 4 5 = 5. 5 10 = 5*2. 6 15 = 5*3. 7 30 = 5*3*2. 8 7 = 7. 9 14 = 7*2. 10 21 = 7*3. 11 42 = 7*3*2. 12 35 = 7*5. (End)
a019565 n = product $ zipWith (^) a000040_list (a030308_row n) -- Reinhard Zumkeller, Apr 27 2013
a:= proc(n) local i, m, r; m:=n; r:=1; for i while m>0 do if irem(m,2,'m')=1 then r:=r*ithprime(i) fi od; r end: seq(a(n), n=0..60); # Alois P. Heinz, Sep 06 2014
Do[m=1;o=1;k1=k;While[ k1>0, k2=Mod[k1, 2];If[k2\[Equal]1, m=m*Prime[o]];k1=(k1-k2)/ 2;o=o+1];Print[m], {k, 0, 55}] (* Lei Zhou, Feb 15 2005 *) Table[Times @@ Prime@ Flatten@ Position[#, 1] &@ Reverse@ IntegerDigits[n, 2], {n, 0, 55}] (* Michael De Vlieger, Aug 27 2016 *) b[0] := {1}; b[n_] := Flatten[{ b[n - 1], b[n - 1] * Prime[n] }]; a = b[6] (* Fred Daniel Kline, Jun 26 2017 *)
a(n)=factorback(vecextract(primes(logint(n+!n,2)+1),n)) \\ M. F. Hasler, Mar 26 2011, updated Aug 22 2014, updated Mar 01 2018
from operator import mul from functools import reduce from sympy import prime def A019565(n): return reduce(mul,(prime(i+1) for i,v in enumerate(bin(n)[:1:-1]) if v == '1')) if n > 0 else 1 # Chai Wah Wu, Dec 25 2014
(define (A019565 n) (let loop ((n n) (i 1) (p 1)) (cond ((zero? n) p) ((odd? n) (loop (/ (- n 1) 2) (+ 1 i) (* p (A000040 i)))) (else (loop (/ n 2) (+ 1 i) p))))) ;; (Requires only the implementation of A000040 for prime numbers.) - Antti Karttunen, Apr 20 2017
a(25) = 200 because 25 = 5^2 * 3^0 * 2^0. a(1024) = 10 = a(3), because 1024 = 2^10; but this two-digit multiplicity overflows into the 10^1 position, which encodes for powers of three.
a054841 1 = 0 a054841 n = sum $ zipWith (*) (map ((10 ^) . subtract 1 . a049084) $ a027748_row n) (map fromIntegral $ a124010_row n) -- Reinhard Zumkeller, Aug 03 2015
A:= n -> add(t[2]*10^(numtheory:-pi(t[1])-1),t= ifactors(n)[2]); seq(A(n), n=1..1000); # Robert Israel, Jul 24 2014
a054841[n_Integer] := Catch[FromDigits[IntegerDigits[Apply[Plus, Which[n == 0, Throw["undefined"], n == 1, 0, Max[Last /@ FactorInteger @ n] > 9, Throw["overflow"], True, Power[10, PrimePi[Abs[#]] - 1]] & /@ Flatten[ConstantArray @@@ FactorInteger[n]]]]]] (* Michael De Vlieger, Jul 24 2014 *)
A054841(n)=sum(i=1,#n=factor(n)~,10^primepi(n[1,i])*n[2,i])/10 \\ M. F. Hasler, Nov 16 2008
from sympy import factorint, primepi def a(n): return sum(e*10**(primepi(p)-1) for p, e in factorint(n).items()) print([a(n) for n in range(1, 41)]) # Michael S. Branicky, Mar 17 2024
a(12) = 2^2 * 3^1 = 12. a(231) = 2^3 * 3^2 * 5^1 = 360.
The first few terms are computed as follows: n b2 b1 b0 a(n) 0, 0, 0, 0, 1 1, 0, 0, 1, 2 2, 0, 0, 2, 4 3, 0, 1, 0, 3 4, 0, 1, 1, 6 5, 0, 1, 2, 12 a(11) = a(102_3) and so we get prime(3)^1 * prime(2)^0 * prime(1)^2 = 5^1 * 3^0 * 2^2 = 5 * 1 * 4 = 20. - _Gordon Hamilton_, Aug 13 2025
primeBase[n_Integer?Positive, base_Integer]/;base>1 := Times @@ (Table[Prime[i], {i, Floor[Log[base, n] + 1], 1, -1}]^IntegerDigits[n, base]); Table[primeBase[n, 3], {n, 59}] (* Robert G. Wilson v, Dec 24 2004 *)
a(n) = {my(d = digits(n, 3), pr = primes(#d)); prod(i = 1, #d, pr[#d + 1 - i]^d[i])} \\ David A. Corneth, Aug 13 2025
a(13) = a(1 + 3*4) = 2^1 * 3^3 = 54. a(29) = a(1 + 3*4 + 1*4^2) = 2^1 * 3^3 * 5^1 = 270.
a:= n-> (l-> mul(ithprime(i)^l[i], i=1..nops(l)))(convert(n, base, 4)): seq(a(n), n=0..60); # Alois P. Heinz, Aug 31 2024
f[n_Integer, base_Integer] /; base >= 2 := Product[ Prime[i]^IntegerDigits[n, base][[Length[IntegerDigits[n, base]] + 1 - i]], {i, Length[IntegerDigits[n, base]]}] Table[f[i, 4], {i, 0, 45}]
f(n, b) = { my(d = digits(n,b), L = #d); prod(i=1, L, prime(i)^d[L+1-i]) } apply(n -> f(n, 4), [0..45]) \\ Satish Bysany, Mar 07 2017
a(29) = a(4 + 0*5 + 1*5^2) = 2^4 * 3^0 * 5^1 = 80.
a:= n-> (l-> mul(ithprime(i)^l[i], i=1..nops(l)))(convert(n, base, 5)): seq(a(n), n=0..60); # Alois P. Heinz, Aug 31 2024
f[n_Integer, base_Integer] /; base >= 2 := Product[ Prime[i]^IntegerDigits[n, base][[Length[IntegerDigits[n, base]] + 1 - i]], {i, Length[IntegerDigits[n, base]]}] Table[f[i, 5], {i, 0, 45}]
f(n, b) = { my(d = digits(n,b), L = #d); prod(i=1, L, prime(i)^d[L+1-i]) } apply(n -> f(n, 5), [0..45]) \\ Satish Bysany, Mar 07 2017
For k = 10 = 2^1 * 3^0 * 5^1, k = B^0 * 1 + B^1 * 0 + B^2 * 1, so we have to solve the equation 10 = 1 + B^2 for a positive integer B, B = 3. But B=-3 works too. Thus 10 is a term. For k = 12 = 2^2 * 3^1, k = B^0 * 2 + B^1 * 1, so we have to solve the equation 12 = 2 + B for a positive integer B. B = 10. Thus 12 is a term. For k = 21 = 2^0 * 3^1 * 5^0 * 7^1, k = B^0 * 0 + B^1 * 1 + B^2 * 0 + B^3 * 1, so we have to solve the equation 21 = B + B^3 for an integer B. No such B exists, so 21 is not a term of this sequence. From _Michel Marcus_, Aug 10 2022: (Start) In other words: 10 is a term because 10 = 5^1 * 3^0 * 2^1 and 101 in base 3 is 10. 12 is a term because 12 = 3^1 * 2^2 and 12 in base 10 is 12. (End)
isok(k) = if (k>1, my(f=factor(k), v=primes(primepi(vecmax(f[,1])))); my(p=sum(i=1, #v, 'x^(i-1)*valuation(k,v[i]))); p -= k; my(c=-polcoef(p, 0)); my(q=(p+c)/x); my(d=divisors(c)); for (k=1, #d, if(subst(q, x, d[k]) == c/d[k], return(1)););); \\ Michel Marcus, Aug 08 2022
\\ See PARI link \\ David A. Corneth, Aug 10 2022
from sympy import divisors, factorint, sieve def ok(n): if n < 2: return False f = factorint(n) a = [f[pi] if pi in f else 0 for pi in sieve.primerange(2, max(f)+1)] for B in range(1, n+1): polyB = sum(B**i*ai for i, ai in enumerate(a) if ai > 0) if polyB == n: return True elif polyB > n: return False return False print([k for k in range(10**4) if ok(k)]) # Michael S. Branicky, Aug 10 2022
Comments