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.

Showing 1-3 of 3 results.

A030101 a(n) is the number produced when n is converted to binary digits, the binary digits are reversed and then converted back into a decimal number.

Original entry on oeis.org

0, 1, 1, 3, 1, 5, 3, 7, 1, 9, 5, 13, 3, 11, 7, 15, 1, 17, 9, 25, 5, 21, 13, 29, 3, 19, 11, 27, 7, 23, 15, 31, 1, 33, 17, 49, 9, 41, 25, 57, 5, 37, 21, 53, 13, 45, 29, 61, 3, 35, 19, 51, 11, 43, 27, 59, 7, 39, 23, 55, 15, 47, 31, 63, 1, 65, 33, 97, 17, 81, 49, 113, 9, 73, 41, 105, 25, 89, 57
Offset: 0

Views

Author

Keywords

Comments

As with decimal reversal, initial zeros are ignored; otherwise, the reverse of 1 would be 1000000... ad infinitum.
Numerators of the binary van der Corput sequence. - Eric Rowland, Feb 12 2008
It seems that in most cases A030101(x) = A000265(x) and that if A030101(x) <> A000265(x), the next time A030101(y) = A000265(x), A030101(x) = A000265(y). Also, it seems that if a pair of values exist at one index, they will exist at any index where one of them exist. It also seems like the greater of the pair always shows up on A000265 first. - Dylan Hamilton, Aug 04 2010
The number of occasions A030101(n) = A000265(n) before n = 2^k is A053599(k) + 1. For n = 0..2^19, the sequences match less than 1% of the time. - Andrew Woods, May 19 2012
For n > 0: a(a(n)) = n if and only if n is odd; a(A006995(n)) = A006995(n). - Juli Mallett, Nov 11 2010, corrected: Reinhard Zumkeller, Oct 21 2011
n is binary palindromic if and only if a(n) = n. - Reinhard Zumkeller, corrected: Jan 17 2012, thanks to Hieronymus Fischer, who pointed this out; Oct 21 2011
Given any n > 1, the set of numbers A030109(i) = (A030101(i) - 1)/2 for indexes i ranging from 2^n to 2^(n + 1) - 1 is a permutation of the set of consecutive integers {0, 1, 2, ..., 2^n - 1}. This is important in the standard FFT algorithms (starting or ending bit-reversal permutation). - Stanislav Sykora, Mar 15 2012
Row n of A030308 gives the binary digits of a(n), prepended with zero at even positions. - Reinhard Zumkeller, Jun 17 2012
The binary van der Corput sequence is the infinite sequence of fractions { A030101(n)/A062383(n), n = 0, 1, 2, 3, ... }, and begins 0, 1/2, 1/4, 3/4, 1/8, 5/8, 3/8, 7/8, 1/16, 9/16, 5/16, 13/16, 3/16, 11/16, 7/16, 15/16, 1/32, 17/32, 9/32, 25/32, 5/32, 21/32, 13/32, 29/32, 3/32, 19/32, 11/32, 27/32, 7/32, 23/32, 15/32, 31/32, 1/64, 33/64, 17/64, 49/64, ... - N. J. A. Sloane, Dec 01 2019
Record highs occur at n = A209492(m) (for n>=1) with values a(n) = A224195(m) (for n>=3). - Bill McEachen, Aug 02 2023

Examples

			a(100) = 19 because 100 (base 10) = 1100100 (base 2) and R(1100100 (base 2)) = 10011 (base 2) = 19 (base 10).
		

References

  • Hlawka E. The theory of uniform distribution. Academic Publishers, Berkhamsted, 1984. See pp. 93, 94 for the van der Corput sequence. - N. J. A. Sloane, Dec 01 2019

Crossrefs

Cf. A055944 (reverse and add), A178225, A273258.
Cf. A056539, A057889 (bijective variants), A224195, A209492.

Programs

  • Haskell
    a030101 = f 0 where
       f y 0 = y
       f y x = f (2 * y + b) x'  where (x', b) = divMod x 2
    -- Reinhard Zumkeller, Mar 18 2014, Oct 21 2011
    
  • J
    ([: #. [: |. #:)"0 NB. Stephen Makdisi, May 07 2018
    
  • Magma
    A030101:=func; // Jason Kimberley, Sep 19 2011
    
  • Maple
    A030101 := proc(n)
        convert(n,base,2) ;
        ListTools[Reverse](%) ;
        add(op(i,%)*2^(i-1),i=1..nops(%)) ;
    end proc: # R. J. Mathar, Mar 10 2015
    # second Maple program:
    a:= proc(n) local m, r; m:=n; r:=0;
          while m>0 do r:=r*2+irem(m, 2, 'm') od; r
        end:
    seq(a(n), n=0..80);  # Alois P. Heinz, Nov 17 2015
  • Mathematica
    Table[FromDigits[Reverse[IntegerDigits[i, 2]], 2], {i, 0, 80}]
    bitRev[n_] := Switch[Mod[n, 4], 0, bitRev[n/2], 1, 2 bitRev[(n + 1)/2] - bitRev[(n - 1)/4], 2, bitRev[n/2], 3, 3 bitRev[(n - 1)/2] - 2 bitRev[(n - 3)/4]]; bitRev[0] = 0; bitRev[1] = 1; bitRev[3] = 3; Array[bitRev, 80, 0] (* Robert G. Wilson v, Mar 18 2014 *)
  • PARI
    a(n)=if(n<1,0,subst(Polrev(binary(n)),x,2))
    
  • PARI
    a(n) = fromdigits(Vecrev(binary(n)), 2); \\ Michel Marcus, Nov 10 2017
    
  • Python
    def a(n): return int(bin(n)[2:][::-1], 2) # Indranil Ghosh, Apr 24 2017
    
  • Sage
    def A030101(n): return Integer(bin(n).lstrip("0b")[::-1],2) if n!=0 else 0
    [A030101(n) for n in (0..78)]  # Peter Luschny, Aug 09 2012
    
  • Scala
    (0 to 127).map(n => Integer.parseInt(Integer.toString(n, 2).reverse, 2)) // Alonso del Arte, Feb 11 2020

Formula

a(n) = 0, a(2n) = a(n), a(2n+1) = a(n) + 2^(floor(log_2(n)) + 1). For n > 0, a(n) = 2*A030109(n) - 1. - Ralf Stephan, Sep 15 2003
a(n) = b(n, 0) with b(n, r) = r if n = 0, otherwise b(floor(n/2), 2*r + n mod 2). - Reinhard Zumkeller, Mar 03 2010
a(1) = 1, a(3) = 3, a(2n) = a(n), a(4n+1) = 2a(2n+1) - a(n), a(4n+3) = 3a(2n+1) - 2a(n) (as in the Project Euler problem). To prove this, expand the recurrence into binary strings and reversals. - David Applegate, Mar 16 2014, following a posting to the Sequence Fans Mailing List by Martin Møller Skarbiniks Pedersen.
Conjecture: a(n) = 2*w(n) - 2*w(A053645(n)) - 1 for n > 0, where w = A264596. - Velin Yanev, Sep 12 2017

Extensions

Edits (including correction of an erroneous date pointed out by J. M. Bergot) by Jon E. Schoenfield, Mar 16 2014
Name clarified by Antti Karttunen, Nov 09 2017

A293448 Self-inverse permutation of natural numbers: replace (with multiplicity) each prime factor A000040(k) with A000040(min+(max-k)) in the prime factorization of n, where min = A055396(n) and max = A061395(n).

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 18, 13, 14, 15, 16, 17, 12, 19, 50, 21, 22, 23, 54, 25, 26, 27, 98, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 250, 41, 70, 43, 242, 75, 46, 47, 162, 49, 20, 51, 338, 53, 24, 55, 686, 57, 58, 59, 150, 61, 62, 147, 64, 65, 154, 67, 578, 69, 42, 71, 108, 73, 74, 45, 722, 77, 286, 79, 1250, 81, 82, 83
Offset: 1

Views

Author

Antti Karttunen, Nov 09 2017

Keywords

Comments

Reverse the prime-indices in such a way that the smallest and the greatest prime dividing n (A020639 and A006530) are preserved.
a(n) = n iff n belongs to A236510. - Rémy Sigrist, Nov 22 2017

Examples

			For n = 25 = 5^2 = prime(3)^2, thus min = max = 3, and we form a product prime(3+(3-3))^2, thus a(25) = prime(3)^2 = 25.
For n = 42 = 2*3*7 = prime(1)*prime(2)*prime(4), thus min = 1 and max = 4, so we form a product prime(1+(4-1))*prime(1+(4-2))*prime(1+(4-4)), thus a(42) = prime(4)*prime(3)*prime(1) = 7*5*2 = 70.
For n = 126 = 2 * 3^2 * 7 = prime(1) * prime(2)^2 * prime(4), thus min = 1 and max = 4, so we form a product prime(1+(4-1)) * prime(1+(4-2))^2 * prime(1+(4-4)), thus a(126) = prime(4) * prime(3)^2 * prime(1) = 7 * 5^2 * 2 = 350.
		

Crossrefs

Cf. A000720, A055396, A057889, A061395, A236510 (fixed points), A273258.
Differs from A069799 (and some other related permutations) for the first time at n=42.

Programs

  • PARI
    A293448(n) = { if(1==n,return(n)); my(f=factor(n), mini = primepi(f[1, 1]), maxi = primepi(f[#f~, 1])); for(i=1,#f~,f[i,1] = prime((maxi-primepi(f[i,1]))+mini)); factorback(f); }

Formula

For all even squarefree numbers coincides with A273258, that is, for all n, a(A039956(n)) = A273258(A039956(n)).

A276379 Write a "1" for each distinct prime divisor p of n in the (pi(p) - 1)-th place, ignoring multiplicity.

Original entry on oeis.org

0, 1, 10, 1, 100, 11, 1000, 1, 10, 101, 10000, 11, 100000, 1001, 110, 1, 1000000, 11, 10000000, 101, 1010, 10001, 100000000, 11, 100, 100001, 10, 1001, 1000000000, 111, 10000000000, 1, 10010, 1000001, 1100, 11, 100000000000, 10000001, 100010, 101, 1000000000000, 1011, 10000000000000, 10001, 110
Offset: 1

Views

Author

Michael De Vlieger, Sep 02 2016

Keywords

Comments

a(n) notes the distinct prime divisors p of n by writing "1" in the (pi(n)-1)-th place. Zeros hold the places of primes q less than the greatest prime divisor p that do not divide n. Thus a(n) consists of 1's and 0's like a binary number where each bit value, instead of representing 2^k, represents prime(k + 1).
a(n) = A054841(n) with all nonzero digits converted to 1's.
a(n) = a(A007947(n)), that is, a number n shares a value of a(n) with the largest squarefree divisor A007947(n). Thus a(18) = a(6) = 11.
a(p) = 1 in the leftmost place followed by (pi(p)-1) zeros.
This function is akin to A054841(n) except we don't note the multiplicity e of p in n, rather merely note "1" if e > 0.
Unlike A054841(1024) = 10, there are no overflows in a(n) into the next place that encodes prime(p+1) due to "carry". 1024 = 2^10, thus a(1024) = a(2^e) = 1, with e >= 1 = 1.

Examples

			a(1) = 0 since 1 is the empty product. a(0) is undefined.
a(6) = a(12) = 11, since 6 and 12 are products of the 1st and 2nd primes (i.e., 2 and 3). Thus we write 1's in the corresponding places. Any number n that is the product only of powers e >= 1 of 2 and 3 (e.g., 24, 96, 144, etc.) has a(n) = 11.
a(42) = 1011, since the prime divisors of 42 are 2, 3 and 7. Any number n that is the product only of powers e >= 1 of all of 2, 3 and 7 has a(n) = 1011.
a(70) = 1101, since its prime divisors are 2, 5 and 7.
		

Crossrefs

Cf. A027748, A054841 (write multiplicity instead of 1 in the (pi(p)-1)th place), A079067 (reverse 0's and 1's in a(n) and convert to decimal), A087207 (a(n) interpreted as a binary number), A273258 (a(n) reversed and converted to decimal).
Sequence A087207 shown in base-2.

Programs

  • Maple
    a:= n-> add(10^numtheory[pi](i[1]), i=ifactors(n)[2])/10:
    seq(a(n), n=1..53);  # Alois P. Heinz, Feb 10 2020
  • Mathematica
    f[n_] := If[n == 1, {0}, Function[k, ReplacePart[Table[0, {PrimePi[k[[-1, 1]]]}], #] &@ Map[PrimePi@ First@ # -> 1 &, k]]@ FactorInteger@ n]; Table[FromDigits@ Reverse@ f@ n, {n, 45}] (* or *)
    FromDigits[IntegerDigits[#, 2]] & /@ Table[Floor@ Total[2^(PrimePi /@ FactorInteger[n][[All, 1]] - 1)], {n, 45}] (* latter program after Jean-François Alcover at A087207 *)

Formula

a(n) = A054841(A007947(n)) = A007088(A087207(n)). - Antti Karttunen, Jun 18 2017
G.f.: Sum_{k>=1} 10^(k-1) * x^prime(k) / (1 - x^prime(k)). - Ilya Gutkovskiy, Feb 10 2020
Showing 1-3 of 3 results.