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.
%I A005940 M0509 #200 Mar 10 2023 16:34:28 %S A005940 1,2,3,4,5,6,9,8,7,10,15,12,25,18,27,16,11,14,21,20,35,30,45,24,49,50, %T A005940 75,36,125,54,81,32,13,22,33,28,55,42,63,40,77,70,105,60,175,90,135, %U A005940 48,121,98,147,100,245,150,225,72,343,250,375,108,625,162,243,64,17,26,39 %N A005940 The Doudna sequence: write n-1 in binary; power of prime(k) in a(n) is # of 1's that are followed by k-1 0's. %C A005940 A permutation of the natural numbers. - _Robert G. Wilson v_, Feb 22 2005 %C A005940 Fixed points: A029747. - _Reinhard Zumkeller_, Aug 23 2006 %C A005940 The even bisection, when halved, gives the sequence back. - _Antti Karttunen_, Jun 28 2014 %C A005940 From _Antti Karttunen_, Dec 21 2014: (Start) %C A005940 This irregular table can be represented as a binary tree. Each child to the left is obtained by applying A003961 to the parent, and each child to the right is obtained by doubling the parent: %C A005940 1 %C A005940 | %C A005940 ...................2................... %C A005940 3 4 %C A005940 5......../ \........6 9......../ \........8 %C A005940 / \ / \ / \ / \ %C A005940 / \ / \ / \ / \ %C A005940 / \ / \ / \ / \ %C A005940 7 10 15 12 25 18 27 16 %C A005940 11 14 21 20 35 30 45 24 49 50 75 36 125 54 81 32 %C A005940 etc. %C A005940 Sequence A163511 is obtained by scanning the same tree level by level, from right to left. Also in binary trees A253563 and A253565 the terms on level of the tree are some permutation of the terms present on the level n of this tree. A252464(n) gives the distance of n from 1 in all these trees. %C A005940 A252737(n) gives the sum and A252738(n) the product of terms on row n (where 1 is on row 0, 2 on row 1, 3 and 4 on row 2, etc.). A252745(n) gives the number of nodes on level n whose left child is larger than the right child, A252750 the difference between left and right child for each node from node 2 onward. %C A005940 (End) %C A005940 -A008836(a(1+n)) gives the corresponding numerator for A323505(n). - _Antti Karttunen_, Jan 19 2019 %C A005940 (a(2n+1)-1)/2 [= A244154(n)-1, for n >= 0] is a permutation of the natural numbers. - _George Beck_ and _Antti Karttunen_, Dec 08 2019 %C A005940 From _Peter Munn_, Oct 04 2020: (Start) %C A005940 Each term has the same even part (equivalently, the same 2-adic valuation) as its index. %C A005940 Using the tree depicted in Antti Karttunen's 2014 comment: %C A005940 Numbers are on the right branch (4 and descendants) if and only if divisible by the square of their largest prime factor (cf. A070003). %C A005940 Numbers on the left branch, together with 2, are listed in A102750. %C A005940 (End) %C A005940 According to Kutz (1981), he learned of this sequence from American mathematician Byron Leon McAllister (1929-2017) who attributed the invention of the sequence to a graduate student by the name of Doudna (first name Paul?) in the mid-1950's at the University of Wisconsin. - _Amiram Eldar_, Jun 17 2021 %C A005940 From _David James Sycamore_, Sep 23 2022: (Start) %C A005940 Alternative (recursive) definition: If n is a power of 2 then a(n)=n. Otherwise, if 2^j is the greatest power of 2 not exceeding n, and if k = n - 2^j, then a(n) is the least m*a(k) that has not occurred previously, where m is an odd prime. %C A005940 Example: Use recursion with n = 77 = 2^6 + 13. a(13) = 25 and since 11 is the smallest odd prime m such that m*a(13) has not already occurred (see a(27), a(29),a(45)), then a(77) = 11*25 = 275. (End) %C A005940 The odd bisection, when transformed by replacing all prime(k)^e in a(2*n - 1) with prime(k-1)^e, returns a(n), and thus gives the sequence back. - _David James Sycamore_, Sep 28 2022 %D A005940 N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence). %H A005940 Antti Karttunen, <a href="/A005940/b005940.txt">Table of n, a(n) for n = 1..8192</a> (terms 1..1024 from Reinhard Zumkeller) %H A005940 Michael De Vlieger, 6 row <a href="/A005940/a005940.png">Doudna Tree diagram</a> as mentioned in Comments. %H A005940 Michael De Vlieger, <a href="/A005940/a005940_2.png">Annotated fan-style binary tree showing 10 levels</a>, with a color function where 2^m is shown in medium blue in row m, k < 2^m is darker blue, and k > 2^m is brighter green, with records in each row shown in red. %H A005940 Ronald E. Kutz, <a href="http://www.jstor.org/stable/3027304">Two unusual sequences</a>, Two-Year College Mathematics Journal, Vol. 12, No. 5 (1981), pp. 316-319. %H A005940 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a> %F A005940 From _Reinhard Zumkeller_, Aug 23 2006, _R. J. Mathar_, Mar 06 2010: (Start) %F A005940 a(n) = f(n-1, 1, 1) %F A005940 where f(n, i, x) = x if n = 0, %F A005940 = f(n/2, i+1, x) if n > 0 is even %F A005940 = f((n-1)/2, i, x*prime(i)) otherwise. (End) %F A005940 From _Antti Karttunen_, Jun 26 2014: (Start) %F A005940 Define a starting-offset 0 version of this sequence as: %F A005940 b(0)=1, b(1)=2, [base cases] %F A005940 and then compute the rest either with recurrence: %F A005940 b(n) = A000040(1+(A070939(n)-A000120(n))) * b(A053645(n)). %F A005940 or %F A005940 b(2n) = A003961(b(n)), b(2n+1) = 2 * b(n). [Compare this to the similar recurrence given for A163511.] %F A005940 Then define a(n) = b(n-1), where a(n) gives this sequence A005940 with the starting offset 1. %F A005940 Can be also defined as a composition of related permutations: %F A005940 a(n+1) = A243353(A006068(n)). %F A005940 a(n+1) = A163511(A054429(n)). [Compare the scatter plots of this sequence and A163511 to each other.] %F A005940 This permutation also maps between the partitions as enumerated in the lists A125106 and A112798, providing identities between: %F A005940 A161511(n) = A056239(a(n+1)). [The corresponding sums ...] %F A005940 A243499(n) = A003963(a(n+1)). [... and the products of parts of those partitions.] %F A005940 (End) %F A005940 From _Antti Karttunen_, Dec 21 2014 - Jan 04 2015: (Start) %F A005940 A002110(n) = a(1+A002450(n)). [Primorials occur at (4^n - 1)/3 in the offset-0 version of the sequence.] %F A005940 a(n) = A250246(A252753(n-1)). %F A005940 a(n) = A122111(A253563(n-1)). %F A005940 For n >= 1, A055396(a(n+1)) = A001511(n). %F A005940 For n >= 2, a(n) = A246278(1+A253552(n)). %F A005940 (End) %F A005940 From _Peter Munn_, Oct 04 2020: (Start) %F A005940 A000265(a(n)) = a(A000265(n)) = A003961(a(A003602(n))). %F A005940 A006519(a(n)) = a(A006519(n)) = A006519(n). %F A005940 a(n) = A003961(a(A003602(n))) * A006519(n). %F A005940 A007814(a(n)) = A007814(n). %F A005940 A007949(a(n)) = A337821(n) = A007814(A003602(n)). %F A005940 a(n) = A225546(A334866(n-1)). %F A005940 (End) %F A005940 a(2n) = 2*a(n), or generally a(2^k*n) = 2^k*a(n). - _Amiram Eldar_, Oct 03 2022 %F A005940 If n-1 = Sum_{i} 2^(q_i-1), then a(n) = Product_{i} prime(q_i-i+1). These are the Heinz numbers of the rows of A125106. If the offset is changed to 0, the inverse is A156552. - _Gus Wiseman_, Dec 28 2022 %e A005940 From _N. J. A. Sloane_, Aug 22 2022: (Start) %e A005940 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. %e A005940 If n=9, n-1 is 1000, c_3 = 1, a(9) = p(4)^1 = 7. %e A005940 If n=10, n-1 = 1001, c_0 = 1, c_2 = 1, a(10) = p(1)*p(3) = 2*5 = 10. %e A005940 If n=11, n-1 = 1010, c_1 = 1, c_2 = 1, a(11) = p(2)*p(3) = 15. (End) %p A005940 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: %p A005940 A005940 := proc(n) f(n-1,1,1) ; end proc: # _R. J. Mathar_, Mar 06 2010 %t A005940 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 *) %t A005940 Table[Times@@Prime/@(Join@@Position[Reverse[IntegerDigits[n,2]],1]-Range[DigitCount[n,2,1]]+1),{n,0,100}] (* _Gus Wiseman_, Dec 28 2022 *) %o A005940 (PARI) 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 %o A005940 (PARI) 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 %o A005940 (Haskell) %o A005940 a005940 n = f (n - 1) 1 1 where %o A005940 f 0 y _ = y %o A005940 f x y i | m == 0 = f x' y (i + 1) %o A005940 | m == 1 = f x' (y * a000040 i) i %o A005940 where (x',m) = divMod x 2 %o A005940 -- _Reinhard Zumkeller_, Oct 03 2012 %o A005940 (Scheme, with memoization-macro definec from Antti Karttunen's IntSeq-library) %o A005940 (define (A005940 n) (A005940off0 (- n 1))) ;; The off=1 version, utilizing any one of three different offset-0 implementations: %o A005940 (definec (A005940off0 n) (cond ((< n 2) (+ 1 n)) (else (* (A000040 (- (A070939 n) (- (A000120 n) 1))) (A005940off0 (A053645 n)))))) %o A005940 (definec (A005940off0 n) (cond ((<= n 2) (+ 1 n)) ((even? n) (A003961 (A005940off0 (/ n 2)))) (else (* 2 (A005940off0 (/ (- n 1) 2)))))) %o A005940 (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))))))) %o A005940 ;; _Antti Karttunen_, Jun 26 2014 %o A005940 (Python) %o A005940 from sympy import prime %o A005940 import math %o A005940 def A(n): return n - 2**int(math.floor(math.log(n, 2))) %o A005940 def b(n): return n + 1 if n<2 else prime(1 + (len(bin(n)[2:]) - bin(n)[2:].count("1"))) * b(A(n)) %o A005940 print([b(n - 1) for n in range(1, 101)]) # _Indranil Ghosh_, Apr 10 2017 %o A005940 (Python) %o A005940 from math import prod %o A005940 from itertools import accumulate %o A005940 from collections import Counter %o A005940 from sympy import prime %o A005940 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 %Y A005940 Cf. A103969. Inverse is A005941 (A156552). %Y A005940 Cf. A125106. [From _Franklin T. Adams-Watters_, Mar 06 2010] %Y A005940 Cf. A252737 (gives row sums), A252738 (row products), A332979 (largest on row). %Y A005940 Related permutations of positive integers: A163511 (via A054429), A243353 (via A006068), A244154, A253563 (via A122111), A253565, A332977, A334866 (via A225546). %Y A005940 A000120, A003602, A003961, A006519, A053645, A070939, A246278, A250246, A252753, A253552 are used in a formula defining this sequence. %Y A005940 Formulas for f(a(n)) are given for f = A000265, A003963, A007949, A055396, A056239. %Y A005940 Numbers that occur at notable sets of positions in the binary tree representation of the sequence: A000040, A000079, A002110, A070003, A070826, A102750. %Y A005940 Cf. also A000142, A001511, A002450, A112798, A252463, A252464, A252745, A252750, A324054, A324106, A323505, A323508. %Y A005940 Cf. A106737, A290077, A323915, A324052, A324054, A324055, A324056, A324057, A324058, A324114, A324335, A324340, A324348, A324349 for various number-theoretical sequences applied to (i.e., permuted by) this sequence. %Y A005940 k-adic valuation: A007814 (k=2), A337821 (k=3). %Y A005940 Positions of multiples of 3: A091067. %Y A005940 Primorial deflation: A337376 / A337377. %Y A005940 Sum of prime indices of a(n) is A161511, reverse version A359043. %Y A005940 A048793 lists binary indices, ranked by A019565. %Y A005940 A066099 lists standard comps, partial sums A358134 (ranked by A358170). %Y A005940 Cf. A001222, A029837, A059893, A241916, A242628, A253566, A359042. %K A005940 nonn,easy,nice,tabf,look %O A005940 1,2 %A A005940 _N. J. A. Sloane_ and _J. H. Conway_ %E A005940 More terms from _Robert G. Wilson v_, Feb 22 2005 %E A005940 Sign in a formula switched and Maple program added by _R. J. Mathar_, Mar 06 2010 %E A005940 Binary tree illustration and keyword tabf added by _Antti Karttunen_, Dec 21 2014