A252739 a(n) = A252738(n) / n.
2, 6, 720, 612360000, 1697781042840960000000000, 504261397867001013813789115612253942400000000000000000000000000
Offset: 1
Keywords
Formula
a(n) = A252738(n) / n.
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.
allocatemem(234567890); A003961(n) = my(f = factor(n)); for (i=1, #f~, f[i, 1] = nextprime(f[i, 1]+1)); factorback(f); \\ Using code of Michel Marcus A252741print(up_to_n) = { my(s, i=0, n=0); for(n=0, up_to_n, if(0 == n, s = 1, if(1 == n, s = 2; lev = vector(1); lev[1] = 2, oldlev = lev; lev = vector(2*length(oldlev)); s = 1; for(i = 0, (2^(n-1))-1, lev[i+1] = if((i%2),A003961(oldlev[(i\2)+1]),2*oldlev[(i\2)+1]); s *= lev[i+1]))); write("b252741.txt", n, " ", s/n!)); }; A252741print(6); \\ Produces the same terms.
(define (A252741 n) (/ (A252738 n) (A000142 n)))
a(12) = a(2^2 * 3) = a(prime(1)^2 * prime(2)) = prime(2)^2 * prime(3) = 3^2 * 5 = 45. a(A002110(n)) = A002110(n + 1) / 2.
a003961 1 = 1 a003961 n = product $ map (a000040 . (+ 1) . a049084) $ a027746_row n -- Reinhard Zumkeller, Apr 09 2012, Oct 09 2011 (MIT/GNU Scheme, with Aubrey Jaffer's SLIB Scheme library) (require 'factor) (define (A003961 n) (apply * (map A000040 (map 1+ (map A049084 (factor n)))))) ;; Antti Karttunen, May 20 2014
a:= n-> mul(nextprime(i[1])^i[2], i=ifactors(n)[2]): seq(a(n), n=1..80); # Alois P. Heinz, Sep 13 2017
a[p_?PrimeQ] := a[p] = Prime[ PrimePi[p] + 1]; a[1] = 1; a[n_] := a[n] = Times @@ (a[#1]^#2& @@@ FactorInteger[n]); Table[a[n], {n, 1, 65}] (* Jean-François Alcover, Dec 01 2011, updated Sep 20 2019 *) Table[Times @@ Map[#1^#2 & @@ # &, FactorInteger[n] /. {p_, e_} /; e > 0 :> {Prime[PrimePi@ p + 1], e}] - Boole[n == 1], {n, 65}] (* Michael De Vlieger, Mar 24 2017 *)
a(n)=local(f); if(n<1,0,f=factor(n); prod(k=1,matsize(f)[1],nextprime(1+f[k,1])^f[k,2]))
a(n) = my(f = factor(n)); for (i=1, #f~, f[i, 1] = nextprime(f[i, 1]+1)); factorback(f); \\ Michel Marcus, May 17 2014
use ntheory ":all"; sub a003961 { vecprod(map { next_prime($) } factor(shift)); } # _Dana Jacobsen, Mar 06 2016
from sympy import factorint, prime, primepi, prod def a(n): f=factorint(n) return 1 if n==1 else prod(prime(primepi(i) + 1)**f[i] for i in f) [a(n) for n in range(1, 11)] # Indranil Ghosh, May 13 2017
From _N. J. A. Sloane_, Aug 22 2022: (Start) Let c_i = number of 1's in binary expansion of n-1 that have i 0's to their right, and let p(j) = j-th prime. Then a(n) = Product_i p(i+1)^c_i. If n=9, n-1 is 1000, c_3 = 1, a(9) = p(4)^1 = 7. If n=10, n-1 = 1001, c_0 = 1, c_2 = 1, a(10) = p(1)*p(3) = 2*5 = 10. If n=11, n-1 = 1010, c_1 = 1, c_2 = 1, a(11) = p(2)*p(3) = 15. (End)
a005940 n = f (n - 1) 1 1 where f 0 y _ = y f x y i | m == 0 = f x' y (i + 1) | m == 1 = f x' (y * a000040 i) i where (x',m) = divMod x 2 -- Reinhard Zumkeller, Oct 03 2012 (Scheme, with memoization-macro definec from Antti Karttunen's IntSeq-library) (define (A005940 n) (A005940off0 (- n 1))) ;; The off=1 version, utilizing any one of three different offset-0 implementations: (definec (A005940off0 n) (cond ((< n 2) (+ 1 n)) (else (* (A000040 (- (A070939 n) (- (A000120 n) 1))) (A005940off0 (A053645 n)))))) (definec (A005940off0 n) (cond ((<= n 2) (+ 1 n)) ((even? n) (A003961 (A005940off0 (/ n 2)))) (else (* 2 (A005940off0 (/ (- n 1) 2)))))) (define (A005940off0 n) (let loop ((n n) (i 1) (x 1)) (cond ((zero? n) x) ((even? n) (loop (/ n 2) (+ i 1) x)) (else (loop (/ (- n 1) 2) i (* x (A000040 i))))))) ;; Antti Karttunen, Jun 26 2014
f := proc(n,i,x) option remember ; if n = 0 then x; elif type(n,'even') then procname(n/2,i+1,x) ; else procname((n-1)/2,i,x*ithprime(i)) ; end if; end proc: A005940 := proc(n) f(n-1,1,1) ; end proc: # R. J. Mathar, Mar 06 2010
f[n_] := Block[{p = Partition[ Split[ Join[ IntegerDigits[n - 1, 2], {2}]], 2]}, Times @@ Flatten[ Table[q = Take[p, -i]; Prime[ Count[ Flatten[q], 0] + 1]^q[[1, 1]], {i, Length[p]}] ]]; Table[ f[n], {n, 67}] (* Robert G. Wilson v, Feb 22 2005 *) Table[Times@@Prime/@(Join@@Position[Reverse[IntegerDigits[n,2]],1]-Range[DigitCount[n,2,1]]+1),{n,0,100}] (* Gus Wiseman, Dec 28 2022 *)
A005940(n) = { my(p=2, t=1); n--; until(!n\=2, n%2 && (t*=p) || p=nextprime(p+1)); t } \\ M. F. Hasler, Mar 07 2010; update Aug 29 2014
a(n)=my(p=2, t=1); for(i=0,exponent(n), if(bittest(n,i), t*=p, p=nextprime(p+1))); t \\ Charles R Greathouse IV, Nov 11 2021
from sympy import prime import math def A(n): return n - 2**int(math.floor(math.log(n, 2))) def b(n): return n + 1 if n<2 else prime(1 + (len(bin(n)[2:]) - bin(n)[2:].count("1"))) * b(A(n)) print([b(n - 1) for n in range(1, 101)]) # Indranil Ghosh, Apr 10 2017
from math import prod from itertools import accumulate from collections import Counter from sympy import prime def A005940(n): return prod(prime(len(a)+1)**b for a, b in Counter(accumulate(bin(n-1)[2:].split('1')[:0:-1])).items()) # Chai Wah Wu, Mar 10 2023
For n=3, whose binary representation is "11", we have A000120(3)=2, with A163510(3,1) = A163510(3,2) = 0, thus a(3) = p(2) * p(1)^0 * p(2)^0 = 3*1*1 = 3. For n=9, "1001" in binary, we have A000120(9)=2, with A163510(9,1) = 0 and A163510(9,2) = 2, thus a(9) = p(2) * p(1)^0 * p(2)^2 = 3*1*9 = 27. For n=10, "1010" in binary, we have A000120(10)=2, with A163510(10,1) = 1 and A163510(10,2) = 1, thus a(10) = p(2) * p(1)^1 * p(2)^1 = 3*2*3 = 18. For n=15, "1111" in binary, we have A000120(15)=4, with A163510(15,1) = A163510(15,2) = A163510(15,3) = A163510(15,4) = 0, thus a(15) = p(4) * p(1)^0 * p(2)^0 * p(3)^0 * p(4)^0 = 7*1*1*1*1 = 7. [1], [2], [1,1], [3], [1,2], [2,1] ... -> [1], [2], [3], [1,2], ... -> [0], [1], [2], [0,1], ... -> 2^0, 2^1, 2^2, 2^0*3^1, ... = 1, 2, 4, 3, ... - _Lorenzo Sauras Altuzarra_, Nov 28 2020
f[n_] := Reverse@ Map[Ceiling[(Length@ # - 1)/2] &, DeleteCases[Split@ Join[Riffle[IntegerDigits[n, 2], 0], {0}], {k__} /; k == 1]]; {1}~Join~ Table[Function[t, Prime[t] Product[Prime[m]^(f[n][[m]]), {m, t}]][DigitCount[n, 2, 1]], {n, 120}] (* Michael De Vlieger, Jul 25 2016 *)
from sympy import prime def A163511(n): if n: k, c, m = n, 0, 1 while k: c += 1 m *= prime(c)**(s:=(~k&k-1).bit_length()) k >>= s+1 return m*prime(c) return 1 # Chai Wah Wu, Jul 17 2023
From _Gus Wiseman_, Dec 23 2022: (Start) This represents the following bijection between compositions and partitions. The n-th composition in standard order together with the reversed prime indices of a(n) are: 0: () -> () 1: (1) -> (1) 2: (2) -> (2) 3: (1,1) -> (1,1) 4: (3) -> (3) 5: (2,1) -> (2,2) 6: (1,2) -> (2,1) 7: (1,1,1) -> (1,1,1) 8: (4) -> (4) 9: (3,1) -> (3,3) 10: (2,2) -> (3,2) 11: (2,1,1) -> (2,2,2) 12: (1,3) -> (3,1) 13: (1,2,1) -> (2,2,1) 14: (1,1,2) -> (2,1,1) 15: (1,1,1,1) -> (1,1,1,1) (End)
stc[n_]:=Differences[Prepend[Join @@ Position[Reverse[IntegerDigits[n,2]],1],0]]//Reverse; Times@@Prime/@#&/@Table[Accumulate[stc[n]-1]+1,{n,0,60}] (* Gus Wiseman, Dec 17 2022 *)
a:= proc(n) local m; m:= n; [0]; while m>0 do `if`(1= irem(m, 2, 'm'), map(x-> x+1, %), [%[], 0]) od: `if`(n=0, 1, mul(ithprime(i), i=%)) end: seq(a(n), n=0..100); # Alois P. Heinz, Aug 23 2017
p[n_] := p[n] = FactorInteger[n][[-1, 1]]; b[n_] := n p[n]; c[1] = 1; c[n_] := (n/p[n]) NextPrime[p[n]]; a[0] = 1; a[1] = 2; a[n_] := a[n] = If[EvenQ[n], b[a[n/2]], c[a[(n-1)/2]]]; a /@ Range[0, 100] (* Jean-François Alcover, Feb 15 2021 *)
a(1) = 2^1 = 2 and x^2 - 2 is the minimal polynomial for the algebraic number sqrt(2). a(4) = 2^8*3^4*5^2*7^1 = 3628800 and x^16 - 3628800 is the minimal polynomial for the algebraic number sqrt(2*sqrt(3*sqrt(5*sqrt(7)))).
[n le 1 select 2 else Self(n-1)^2*NthPrime(n): n in [1..10]]; // Vincenzo Librandi, Feb 06 2016
a:= proc(n) option remember; `if`(n=0, 1, a(n-1)^2*ithprime(n)) end: seq(a(n), n=0..8); # Alois P. Heinz, Mar 05 2020
RecurrenceTable[{a[1] == 2, a[n] == a[n-1]^2 Prime[n]}, a, {n, 10}] (* Vincenzo Librandi, Feb 06 2016 *) Table[Product[Prime[k]^2^(n-k),{k,n}],{n,0,10}] (* or *) nxt[{n_,a_}]:={n+1,a^2 Prime[n+1]}; NestList[nxt,{0,1},10][[All,2]] (* Harvey P. Dale, Jan 07 2022 *)
a(n) = prod(k=1, n, prime(k)^(2^(n-k)))
;; Two variants, both with memoization-macro definec. (definec (A191555 n) (if (= 1 n) 2 (* (A000040 n) (A000290 (A191555 (- n 1)))))) ;; After the original recurrence. (definec (A191555 n) (if (= 1 n) 2 (* (A000079 (A000079 (- n 1))) (A003961 (A191555 (- n 1)))))) ;; After the alternative recurrence - Antti Karttunen, Feb 06 2016
Comments