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.

Previous Showing 41-50 of 155 results. Next

A286384 a(n) = A278233(A006068(n)).

Original entry on oeis.org

1, 2, 2, 2, 6, 4, 4, 8, 6, 12, 2, 8, 6, 2, 12, 2, 24, 12, 6, 24, 2, 12, 6, 16, 16, 2, 30, 6, 6, 36, 4, 12, 6, 72, 2, 24, 12, 2, 30, 48, 6, 32, 6, 2, 60, 12, 6, 32, 6, 6, 48, 12, 6, 60, 2, 2, 30, 12, 24, 72, 2, 6, 12, 6, 60, 12, 12, 216, 6, 6, 6, 48, 6, 2, 60, 48, 6, 60, 2, 96, 2, 12, 30, 2, 96, 12, 30, 6, 6, 180, 2, 24, 24, 8, 30, 64, 36, 2, 30, 6, 30, 144, 4
Offset: 1

Views

Author

Antti Karttunen, May 08 2017

Keywords

Crossrefs

Programs

Formula

a(n) = A278233(A006068(n)).

A286556 Permutation of nonnegative integers: a(n) = A006068(A252754(n)).

Original entry on oeis.org

0, 1, 3, 2, 7, 6, 15, 5, 4, 14, 31, 13, 63, 30, 12, 10, 127, 9, 255, 29, 11, 62, 511, 26, 8, 126, 28, 61, 1023, 25, 2047, 21, 27, 254, 24, 18, 4095, 510, 60, 58, 8191, 22, 16383, 125, 20, 1022, 32767, 53, 16, 17, 19, 253, 65535, 57, 23, 122, 59, 2046, 131071, 50, 262143, 4094, 124, 42, 56, 54, 524287, 509, 52, 49, 1048575, 37
Offset: 1

Views

Author

Antti Karttunen, May 13 2017

Keywords

Comments

Note the indexing: the domain starts from one, but the range includes also zero.

Crossrefs

Inverse: A286555.
Differs from similarly constructed A243354 for the first time at n=21, where a(21) = 11, while A243354(21) = 28.

Programs

Formula

a(n) = A006068(A252754(n)).

A292204 Primes as they appear in A006068.

Original entry on oeis.org

3, 2, 7, 5, 13, 11, 31, 29, 17, 19, 23, 61, 59, 53, 37, 47, 41, 43, 127, 113, 97, 103, 101, 109, 107, 67, 71, 79, 73, 89, 83, 251, 241, 227, 229, 239, 233, 193, 199, 197, 223, 211, 131, 137, 139, 157, 151, 149, 191, 179, 181, 163, 167, 173, 509, 499, 503, 487, 491, 449, 463, 461
Offset: 1

Views

Author

Robert G. Wilson v, Sep 11 2017

Keywords

Comments

a(n) is the i-th prime (as it appears in A000040) for i = 2, 1, 4, 3, 6, 5, 9, 10, 11, 8, 7, 15, 17, 18, 16, 14, etc.

Crossrefs

Programs

  • Mathematica
    f[n_] := BitXor @@ Table[ Floor[n/2^m], {m, 0, Floor[Log2@ n]}]; Select[ Array[f, 300], PrimeQ]
  • PARI
    grayinto(n) = my(B=n); for(k=1, log(n+1)\log(2), B=bitxor(B, n\2^k)); B;
    lista(nn) = for (n=1, nn, if (isprime(p=grayinto(n)), print1(p, ", "))); \\ Michel Marcus, Oct 10 2017
    
  • Python
    from itertools import count, islice
    from sympy import isprime
    def A292204_gen(): # generator of terms
        for n in count(0):
            k, m = n, n>>1
            while m > 0:
                k ^= m
                m >>= 1
            if isprime(k):
                yield k
    A292204_list = list(islice(A292204_gen(),30)) # Chai Wah Wu, Jun 29 2022

A292600 a(n) = A006068(floor(n/2)); A006068 with every term duplicated, where A006068 is the inverse of binary gray code.

Original entry on oeis.org

0, 0, 1, 1, 3, 3, 2, 2, 7, 7, 6, 6, 4, 4, 5, 5, 15, 15, 14, 14, 12, 12, 13, 13, 8, 8, 9, 9, 11, 11, 10, 10, 31, 31, 30, 30, 28, 28, 29, 29, 24, 24, 25, 25, 27, 27, 26, 26, 16, 16, 17, 17, 19, 19, 18, 18, 23, 23, 22, 22, 20, 20, 21, 21, 63, 63, 62, 62, 60, 60, 61, 61, 56, 56, 57, 57, 59, 59, 58, 58, 48, 48, 49, 49, 51, 51
Offset: 0

Views

Author

Antti Karttunen, Sep 21 2017

Keywords

Crossrefs

Programs

Formula

a(n) = A006068(A004526(n)) = A006068(floor(n/2)).

A300839 Permutation of nonnegative integers: a(n) = A006068(A057300(n)).

Original entry on oeis.org

0, 3, 1, 2, 15, 12, 14, 13, 7, 4, 6, 5, 8, 11, 9, 10, 63, 60, 62, 61, 48, 51, 49, 50, 56, 59, 57, 58, 55, 52, 54, 53, 31, 28, 30, 29, 16, 19, 17, 18, 24, 27, 25, 26, 23, 20, 22, 21, 32, 35, 33, 34, 47, 44, 46, 45, 39, 36, 38, 37, 40, 43, 41, 42, 255, 252, 254, 253, 240, 243, 241, 242, 248, 251, 249, 250, 247, 244, 246, 245, 192
Offset: 0

Views

Author

Antti Karttunen, Apr 15 2018

Keywords

Crossrefs

Cf. A300838 (inverse permutation).

Programs

  • PARI
    A006068(n)= { my(s=1, ns); while(1, ns = n >> s; if(0==ns, break()); n = bitxor(n, ns); s <<= 1; ); return (n); } \\ From A006068
    A057300(n) = { my(t=1, s=0); while(n>0,  if(1==(n%4),n++,if(2==(n%4),n--)); s += (n%4)*t; n >>= 2; t <<= 2); (s); };
    A300839(n) = A006068(A057300(n));

Formula

a(n) = A006068(A057300(n)).

A302030 a(n) = 1+A006068(A052331(n)).

Original entry on oeis.org

1, 2, 4, 8, 16, 3, 32, 7, 64, 15, 128, 5, 256, 31, 13, 512, 1024, 63, 2048, 9, 29, 127, 4096, 6, 8192, 255, 61, 25, 16384, 14, 32768, 511, 125, 1023, 17, 57, 65536, 2047, 253, 10, 131072, 30, 262144, 121, 49, 4095, 524288, 509, 1048576, 8191, 1021, 249, 2097152, 62, 113, 26, 2045, 16383, 4194304, 12, 8388608, 32767, 33, 505, 241, 126
Offset: 1

Views

Author

Antti Karttunen, Apr 13 2018

Keywords

Comments

This is the inverse of A207901 if it is considered with a starting offset 1.

Crossrefs

One more than A302029.

Programs

  • PARI
    up_to_e = 8192;
    v050376 = vector(up_to_e);
    ispow2(n) = (n && !bitand(n,n-1));
    i = 0; for(n=1,oo,if(ispow2(isprimepower(n)), i++; v050376[i] = n); if(i == up_to_e,break));
    A052331(n) = { my(s=0,e); while(n > 1, fordiv(n, d, if(((n/d)>1)&&ispow2(isprimepower(n/d)), e = vecsearch(v050376, n/d); if(!e, print("v050376 too short!"); return(1/0)); s += 2^(e-1); n = d; break))); (s); };
    A006068(n)= { my(s=1, ns); while(1, ns = n >> s; if(0==ns, break()); n = bitxor(n, ns); s <<= 1; ); return (n); } \\ After code in A006068
    A302030(n) = (1+A006068(A052331(n)));

Formula

a(n) = 1+A302029(n) = 1+A006068(A052331(n)).

A322018 a(n) = A006068(A129760(A003188(n))).

Original entry on oeis.org

0, 0, 3, 0, 7, 4, 7, 0, 15, 8, 11, 8, 15, 12, 15, 0, 31, 16, 19, 16, 23, 20, 23, 16, 31, 24, 27, 24, 31, 28, 31, 0, 63, 32, 35, 32, 39, 36, 39, 32, 47, 40, 43, 40, 47, 44, 47, 32, 63, 48, 51, 48, 55, 52, 55, 48, 63, 56, 59, 56, 63, 60, 63, 0, 127, 64, 67, 64, 71, 68, 71, 64, 79, 72, 75, 72, 79, 76, 79, 64, 95, 80, 83, 80, 87, 84, 87, 80
Offset: 0

Views

Author

Antti Karttunen, Nov 27 2018

Keywords

Comments

For all n, A207901(a(n)) divides A207901(n), and similarly for A302033.

Crossrefs

Programs

Formula

a(n) = A006068(A129760(A003188(n))).

A099893 XOR BINOMIAL transform of A006068 (inverse Gray code).

Original entry on oeis.org

0, 1, 3, 0, 7, 0, 0, 0, 15, 0, 0, 0, 0, 0, 0, 0, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 127
Offset: 0

Views

Author

Paul D. Hanna, Oct 29 2004

Keywords

Comments

See A099884 for the definitions of the XOR BINOMIAL transform and the XOR difference triangle.

Crossrefs

Programs

  • PARI
    {a(n)=local(B);B=0;for(i=0,n,B=bitxor(B,binomial(n,i)%2*A006068(n-i) ));B}

Formula

a(2^n) = 2^(n+1)-1 for n>0, with a(0)=0 and a(k)=0 otherwise. a(n) = SumXOR_{i=0..n} (C(n, i)mod 2)*A006068(n-i) and SumXOR is summation under XOR.

A204686 G.f.: A(x) = Sum_{n>=0} x^n * A(x)^A006068(n) where A006068 forms the inverse permutation of the binary Gray code numbers (A003188).

Original entry on oeis.org

1, 1, 2, 6, 18, 62, 228, 869, 3410, 13663, 55689, 230276, 963851, 4076429, 17394641, 74798044, 323797908, 1409980003, 6171824159, 27141256911, 119854448404, 531261779875, 2362873352568, 10541865261557, 47165485163426, 211572830443060, 951338664998601, 4287174496933723
Offset: 0

Views

Author

Paul D. Hanna, Jan 18 2012

Keywords

Comments

A006068 satisfies: A006068(n) XOR [A006068(n)/2] = n.

Examples

			G.f.: A(x) = 1 + x + 2*x^2 + 6*x^3 + 18*x^4 + 62*x^5 + 228*x^6 +...
The g.f. A(x) satisfies:
A(x) = 1 + x*A(x) + x^2*A(x)^3 + x^3*A(x)^2 + x^4*A(x)^7 + x^5*A(x)^6 + x^6*A(x)^4 + x^7*A(x)^5 + x^8*A(x)^15 + x^9*A(x)^14 + x^10*A(x)^12 +...
where the powers of A(x) are given by A006068, which begins:
[0,1,3,2,7,6,4,5,15,14,12,13,8,9,11,10,31,30,28,29,24,25,27,26,...].
		

Crossrefs

Programs

  • PARI
    {A006068(n)=local(B=n);for(k=1,floor(log(n+1)/log(2)),B=bitxor(B,n\2^k));B}
    {a(n)=local(A=1+x); for(i=1, n, A=sum(m=0, n, x^m*(A+x*O(x^n))^A006068(m))); polcoeff(A, 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.

Original entry on oeis.org

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, 75, 36, 125, 54, 81, 32, 13, 22, 33, 28, 55, 42, 63, 40, 77, 70, 105, 60, 175, 90, 135, 48, 121, 98, 147, 100, 245, 150, 225, 72, 343, 250, 375, 108, 625, 162, 243, 64, 17, 26, 39
Offset: 1

Views

Author

Keywords

Comments

A permutation of the natural numbers. - Robert G. Wilson v, Feb 22 2005
Fixed points: A029747. - Reinhard Zumkeller, Aug 23 2006
The even bisection, when halved, gives the sequence back. - Antti Karttunen, Jun 28 2014
From Antti Karttunen, Dec 21 2014: (Start)
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:
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 75 36 125 54 81 32
etc.
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.
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.
(End)
-A008836(a(1+n)) gives the corresponding numerator for A323505(n). - Antti Karttunen, Jan 19 2019
(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
From Peter Munn, Oct 04 2020: (Start)
Each term has the same even part (equivalently, the same 2-adic valuation) as its index.
Using the tree depicted in Antti Karttunen's 2014 comment:
Numbers are on the right branch (4 and descendants) if and only if divisible by the square of their largest prime factor (cf. A070003).
Numbers on the left branch, together with 2, are listed in A102750.
(End)
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
From David James Sycamore, Sep 23 2022: (Start)
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.
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)
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

Examples

			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)
		

References

  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Cf. A103969. Inverse is A005941 (A156552).
Cf. A125106. [From Franklin T. Adams-Watters, Mar 06 2010]
Cf. A252737 (gives row sums), A252738 (row products), A332979 (largest on row).
Related permutations of positive integers: A163511 (via A054429), A243353 (via A006068), A244154, A253563 (via A122111), A253565, A332977, A334866 (via A225546).
A000120, A003602, A003961, A006519, A053645, A070939, A246278, A250246, A252753, A253552 are used in a formula defining this sequence.
Formulas for f(a(n)) are given for f = A000265, A003963, A007949, A055396, A056239.
Numbers that occur at notable sets of positions in the binary tree representation of the sequence: A000040, A000079, A002110, A070003, A070826, A102750.
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.
k-adic valuation: A007814 (k=2), A337821 (k=3).
Positions of multiples of 3: A091067.
Primorial deflation: A337376 / A337377.
Sum of prime indices of a(n) is A161511, reverse version A359043.
A048793 lists binary indices, ranked by A019565.
A066099 lists standard comps, partial sums A358134 (ranked by A358170).

Programs

  • Haskell
    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
    
  • Maple
    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
  • Mathematica
    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 *)
  • 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
    
  • 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
    
  • Python
    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
    
  • Python
    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

Formula

From Reinhard Zumkeller, Aug 23 2006, R. J. Mathar, Mar 06 2010: (Start)
a(n) = f(n-1, 1, 1)
where f(n, i, x) = x if n = 0,
= f(n/2, i+1, x) if n > 0 is even
= f((n-1)/2, i, x*prime(i)) otherwise. (End)
From Antti Karttunen, Jun 26 2014: (Start)
Define a starting-offset 0 version of this sequence as:
b(0)=1, b(1)=2, [base cases]
and then compute the rest either with recurrence:
b(n) = A000040(1+(A070939(n)-A000120(n))) * b(A053645(n)).
or
b(2n) = A003961(b(n)), b(2n+1) = 2 * b(n). [Compare this to the similar recurrence given for A163511.]
Then define a(n) = b(n-1), where a(n) gives this sequence A005940 with the starting offset 1.
Can be also defined as a composition of related permutations:
a(n+1) = A243353(A006068(n)).
a(n+1) = A163511(A054429(n)). [Compare the scatter plots of this sequence and A163511 to each other.]
This permutation also maps between the partitions as enumerated in the lists A125106 and A112798, providing identities between:
A161511(n) = A056239(a(n+1)). [The corresponding sums ...]
A243499(n) = A003963(a(n+1)). [... and the products of parts of those partitions.]
(End)
From Antti Karttunen, Dec 21 2014 - Jan 04 2015: (Start)
A002110(n) = a(1+A002450(n)). [Primorials occur at (4^n - 1)/3 in the offset-0 version of the sequence.]
a(n) = A250246(A252753(n-1)).
a(n) = A122111(A253563(n-1)).
For n >= 1, A055396(a(n+1)) = A001511(n).
For n >= 2, a(n) = A246278(1+A253552(n)).
(End)
From Peter Munn, Oct 04 2020: (Start)
A000265(a(n)) = a(A000265(n)) = A003961(a(A003602(n))).
A006519(a(n)) = a(A006519(n)) = A006519(n).
a(n) = A003961(a(A003602(n))) * A006519(n).
A007814(a(n)) = A007814(n).
A007949(a(n)) = A337821(n) = A007814(A003602(n)).
a(n) = A225546(A334866(n-1)).
(End)
a(2n) = 2*a(n), or generally a(2^k*n) = 2^k*a(n). - Amiram Eldar, Oct 03 2022
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

Extensions

More terms from Robert G. Wilson v, Feb 22 2005
Sign in a formula switched and Maple program added by R. J. Mathar, Mar 06 2010
Binary tree illustration and keyword tabf added by Antti Karttunen, Dec 21 2014
Previous Showing 41-50 of 155 results. Next