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-10 of 74 results. Next

A096115 If n = (2^k)-1, a(n) = a((n+1)/2) = k, if n = 2^k, a(n) = a(n-1)+1 = k+1, otherwise a(n) = (A000523(n)+1)*a(A035327(n-1)).

Original entry on oeis.org

1, 2, 2, 3, 6, 6, 3, 4, 12, 24, 24, 12, 8, 8, 4, 5, 20, 40, 40, 60, 120, 120, 60, 20, 15, 30, 30, 15, 10, 10, 5, 6, 30, 60, 60, 90, 180, 180, 90, 120, 360, 720, 720, 360, 240, 240, 120, 30, 24, 48, 48, 72, 144, 144, 72, 24, 18, 36, 36, 18, 12, 12, 6, 7, 42, 84, 84, 126
Offset: 1

Views

Author

Amarnath Murthy, Jun 30 2004

Keywords

Comments

A fractal sequence. For k in range [1,(2^n)-1], a(2^n + k)/a(2^n - k) = n+1. Each n > 1 occurs 2*A045778(n) times in the sequence.

Crossrefs

Permutation of A096111, i.e. a(n) = A096111(A122199(n)-1) [Note the different starting offsets]. Cf. A096113, A052330, A096114, A096116.

Programs

Extensions

Edited, extended and Scheme code added by Antti Karttunen, Aug 25 2006

A087734 a(n) = f(f(n)), where f() = A035327().

Original entry on oeis.org

0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 2, 3, 0, 1, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 0, 1, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 0, 1, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17
Offset: 0

Views

Author

N. J. A. Sloane, Oct 01 2003

Keywords

Programs

  • Maple
    a:= n-> ((i->Bits[Nand](i$2))@@2)(n):
    seq(a(n), n=0..100);  # Alois P. Heinz, Sep 29 2019
  • Mathematica
    {0}~Join~Array[Nest[BitXor[#, 2^IntegerPart[Log2@ # + 1] - 1] &, #, 2] /. -1 -> 0 &, 81] (* Michael De Vlieger, Sep 29 2019 *)

Formula

From Mikhail Kurkov, Sep 29 2019: (Start)
Some conjectures:
a(n) = n - Sum_{k=A063250(n)..A000523(n)} 2^k = n - 2^(A000523(n)+1) + 2^A063250(n) for n>0 with a(0)=0.
G.f.: 1/(1-x) * Sum_{j>=0} (2^j)*((x^(2^j))/(1+x^(2^j)) - (1-x^(2^j)) * Sum_{k>=1} x^((2^j)*(2^k-1))).
a(n) = 2*a(floor(n/2)) + n mod 2 - A036987(n) for n>1 with a(0)=a(1)=0.
a(n) = (1 - A036987(n-1))*(1 + A063250(n) - A063250(n-1))*(1 + a(n-1)) for n>0 with a(0)=0. (End)

A096116 a(1)=1, if n=(2^k)+1, a(n) = k+2, otherwise a(n) = 2+A000523(n-1)+a(2+A035327(n-1)).

Original entry on oeis.org

1, 2, 3, 5, 4, 9, 7, 6, 5, 11, 12, 14, 9, 10, 8, 7, 6, 13, 14, 16, 15, 20, 18, 17, 11, 12, 13, 15, 10, 11, 9, 8, 7, 15, 16, 18, 17, 22, 20, 19, 18, 24, 25, 27, 22, 23, 21, 20, 13, 14, 15, 17, 16, 21, 19, 18, 12, 13, 14, 16, 11, 12, 10, 9, 8, 17, 18, 20, 19, 24, 22, 21, 20, 26
Offset: 1

Views

Author

Amarnath Murthy, Jun 30 2004

Keywords

Comments

Each n > 1 occurs A025147(n) times in the sequence.

Crossrefs

Programs

  • Mathematica
    a = {1}; Do[AppendTo[a, If[BitAnd[n - 1, n - 2] == 0, Log2[n - 1] + 2, 2 + Floor[Log2[n - 1]] + a[[2 + BitXor[n - 1, 2^Ceiling[Log2[n]] - 1]]]]], {n, 2, 74}]; a (* Ivan Neretin, Jun 24 2016 *)
  • Scheme
    (define (A096116 n) (cond ((= 1 n) 1) ((pow2? (- n 1)) (+ 2 (A000523 (- n 1)))) (else (+ 2 (A000523 (- n 1)) (A096116 (+ 2 (A035327 (- n 1))))))))
    (define (pow2? n) (and (> n 0) (zero? (A004198bi n (- n 1)))))
    ;; Antti Karttunen, Aug 25 2006

Extensions

Edited and extended by Antti Karttunen, Aug 25 2006

A361989 a(n) is the sum of the Fibonacci numbers missing from the dual Zeckendorf representation of n; a(0) = 0, and for n > 0, a(n) = A022290(A035327(A003754(n+1))).

Original entry on oeis.org

0, 0, 1, 0, 2, 1, 0, 4, 3, 2, 1, 0, 7, 6, 5, 4, 3, 2, 1, 0, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0
Offset: 0

Views

Author

Rémy Sigrist, Apr 02 2023

Keywords

Comments

We consider that a Fibonacci number is missing from the dual Zeckendorf representation of a number if it does not appear in this representation and a larger Fibonacci number appears in it.
The dual Zeckendorf representation is also known as the lazy Fibonacci representation (see A356771 for further details).
This sequence can also be seen as an irregular table T(n, k), n > 0, k = 1..A000045(n), where T(n, k) = A000045(n) - k.
a(n-1) for n>=1 is the starting position of the first occurrence of one of the longest words w in the Fibonacci word A003849 such that no length-n factor of w is repeated. The length of such words is 2n. (See links) - Gandhar Joshi, Mar 19 2024

Examples

			For n = 42:
- using F(k) = A000045(k),
- the dual Zeckendorf representation of 42 is F(8) + F(7) + F(5) + F(3) + F(2),
- the numbers F(6) and F(4) are missing,
- so a(42) = F(6) + F(4) = 8 + 3 = 11.
.
As an irregular triangle the sequence begins:
     0;
     0;
     1,  0;
     2,  1,  0;
     4,  3,  2, 1, 0;
     7,  6,  5, 4, 3, 2, 1, 0;
    12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0;
    ...
		

Crossrefs

Programs

  • PARI
    for (n = 1, 9, for (k = 1, f = fibonacci(n), print1 (f-k", ")))

Formula

a(n) = A000045(A072649(n)) - A194029(n) for n > 0.
a(n) = A130312(n) - A194029(n) for n > 0.

A253608 The binary representation of a(n) is the concatenation of n and the binary complement of n, A035327(n).

Original entry on oeis.org

2, 9, 12, 35, 42, 49, 56, 135, 150, 165, 180, 195, 210, 225, 240, 527, 558, 589, 620, 651, 682, 713, 744, 775, 806, 837, 868, 899, 930, 961, 992, 2079, 2142, 2205, 2268, 2331, 2394, 2457, 2520, 2583, 2646, 2709, 2772, 2835, 2898, 2961, 3024, 3087, 3150, 3213
Offset: 1

Views

Author

Alex Ratushnyak, Jan 05 2015

Keywords

Crossrefs

Programs

  • Maple
    a:= n-> (n+1)*(2^(ilog2(n)+1)-1):
    seq(a(n), n=1..50);  # Alois P. Heinz, Jan 08 2015
  • Mathematica
    Array[(# + 1) (2^(Floor@ Log2[#] + 1) - 1) &, 50] (* Michael De Vlieger, Oct 13 2018 *)
  • PARI
    a(n) = (n+1)*(2^#binary(n)-1); \\ Michel Marcus, Jan 08 2015
  • Python
    for n in range(1,333):
      print(str((n+1)*(2 ** int.bit_length(int(n))-1)), end=',')
    

Formula

a(n) = (n+1) * (2^BL(n) - 1), where BL(n) is the binary length of n.

A323192 Numbers x such that the binary complement of x is larger than the binary complement of x^2: A035327(x) > A035327(x^2).

Original entry on oeis.org

181, 362, 724, 1448, 741455, 11863283, 99516432383215, 1592262918131443, 12738103345051545, 101904826760412361, 203809653520824722, 407619307041649444, 3260954456333195553, 6521908912666391106, 417402170410649030795, 1709679290002018430137083, 3419358580004036860274166
Offset: 1

Views

Author

Alex Ratushnyak, Jan 06 2019

Keywords

Comments

Up to a(13) all the terms are of the form floor(sqrt(2^k-1)) for some k. - Giovanni Resta, Jan 07 2019
From Chai Wah Wu, Jan 10 2019: (Start)
The terms are numbers of the form floor(sqrt(2^(2k-1))) that are larger than 1/2 + sqrt(1/4 + 2^(2k-1) - 2^k) for some k > 0.
Theorem: if x is a term, then it is of the form floor(sqrt(2^(2k-1))) for some k > 0. In addition, floor(sqrt(2^(2k-1))) is a term if and only if it is larger than 1/2 + sqrt(1/4 + 2^(2k-1) - 2^k).
Proof: suppose x has k bits in its binary representation, i.e., 2^(k-1) <= x < 2^k. Then x^2 has either 2k-1 or 2k bits.
First we show that if x is a term of the sequence, then x^2 has 2k-1 bits. Suppose x^2 has 2k bits, i.e., x^2 >= 2^(2k-1). Then 2^2k - 1 - x^2 < 2^k - 1 - x. This is rearranged as x^2 - x + 2^k - 2^2k > 0. Solving this quadratic inequality leads to x > 2^k which contradicts the fact that x has k bits.
Thus x^2 < 2^(2k-1) and 2^(2k-1) - 1 - x^2 < 2^k - 1 - x. Solving this inequality and combining it with x < sqrt(2^(2k-1)) shows that x must satisfy sqrt(2^(2k-1)) > x > 1/2 + sqrt(1/4 + 2^(2k-1) - 2^k).
To complete the proof, we need to show that for each k, there is at most one integer satisfying this inequality. This is easily verified for k = 1. Assume that k > 1. Let a = sqrt(2^(2k-1)) and b = 1/2 + sqrt(1/4 + 2^(2k-1) - 2^k).
Using the identity sqrt(x) - sqrt(y) = (x-y)/(sqrt(x)+sqrt(y)) it follows that a-b = -1/2 + (2^k - 1/4)/(sqrt(2^(2k-1))+sqrt(1/4 + 2^(2k-1) - 2^k) < -1/2 + 2^k/(sqrt(2^(2k-1)) + sqrt(2^(2k-1)-2^k)).
Since k >= 2, sqrt(2^(2k-1)-2^k) = sqrt(2^(2k-1)(1-2^(1-k))) >= sqrt(1/2)*sqrt(2^(2k-1)). This implies that a-b < -1/2 + 2^k/((1+sqrt(1/2))*(sqrt(2^(2k-1)))) = 2*sqrt(2)/(sqrt(2)+1) - 1/2 < 0.672. This implies that there is at most one integer between b and a.
The above discussion also provides another characterization of the sequence. floor(sqrt(2^(2k-1))) is a term if and only if sqrt(2^(2k-1))-floor(sqrt(2^(2k-1))) < a-b where a-b is as defined above.
The criterion can be simplified as:
floor(sqrt(2^(2k-1))) is a term if and only if it is larger than 1/2 + sqrt(1/4 + 2^(2k-1) - 2^k). This concludes the proof.
Note that a-b -> 0.5 as k -> oo, i.e., for large k, the fractional part of sqrt(2^(2k-1)) should be less than about 0.5 in order for the integer part to be a term.
(End)

Crossrefs

Cf. A035327.

Programs

  • Python
    for n in range(1,20000000):
        b1 = (1 << n.bit_length()) - 1
        n2 = n*n
        b2 = (1 << n2.bit_length()) - 1
        if b1-n > b2-n2:  print(str(n), end=', ')
    
  • Python
    from sympy import integer_nthroot
    A323192_list = []
    for k in range(1000):
        n = integer_nthroot(2**(2*k+1),2)[0]
        if n*(n-1) + 2**(len(bin(n))-2) - 2**(len(bin(n**2))-2) > 0:
            A323192_list.append(n) # Chai Wah Wu, Jan 10 2019

Extensions

a(7)-a(13) from Giovanni Resta, Jan 07 2019
a(14)-a(17) from Chai Wah Wu, Jan 10 2019

A323066 Numbers whose binary complement (A035327) is a square.

Original entry on oeis.org

0, 1, 2, 3, 6, 7, 11, 14, 15, 22, 27, 30, 31, 38, 47, 54, 59, 62, 63, 78, 91, 102, 111, 118, 123, 126, 127, 134, 155, 174, 191, 206, 219, 230, 239, 246, 251, 254, 255, 286, 315, 342, 367, 390, 411, 430, 447, 462, 475, 486, 495, 502, 507, 510, 511, 539, 582, 623, 662
Offset: 1

Views

Author

Alex Ratushnyak, Jan 03 2019

Keywords

Comments

The binary complement of every square is in the sequence. Using that might ease computation. - David A. Corneth, Jan 08 2019

Examples

			The binary complement of 22 is 9. Because 9 is a square, 22 is in the sequence.
The binary complement of 4^2 = 16 is 15 so 15 is in the sequence. - _David A. Corneth_, Jan 08 2019
		

Crossrefs

Cf. A035327, A000290, A000225 is a subsequence.

Programs

  • Maple
    q:= n-> issqr(Bits[Nand](n$2)):
    select(q, [$0..1000])[];  # Alois P. Heinz, Sep 03 2021
  • Mathematica
    Select[Range@ 700, IntegerQ@ Sqrt@ FromDigits[IntegerDigits[#, 2] /. {0 -> 1, 1 -> 0}, 2] &] (* Michael De Vlieger, Jan 04 2019 *)
  • PARI
    bc(n) = bitxor(n, 2^(1+logint(max(n, 1), 2))-1); \\ A035327
    isok(n) = issquare(bc(n)); \\ Michel Marcus, Jan 04 2019

A348074 a(n) = A035327(n) if n is even, 3n + 1 if n is odd.

Original entry on oeis.org

1, 4, 1, 10, 3, 16, 1, 22, 7, 28, 5, 34, 3, 40, 1, 46, 15, 52, 13, 58, 11, 64, 9, 70, 7, 76, 5, 82, 3, 88, 1, 94, 31, 100, 29, 106, 27, 112, 25, 118, 23, 124, 21, 130, 19, 136, 17, 142, 15, 148, 13, 154, 11, 160, 9, 166, 7, 172, 5, 178, 3, 184, 1, 190, 63
Offset: 0

Views

Author

Keywords

Examples

			n    parity   function       a(n)
=    =====    =========     ======
0     even    A035327(0)      1
1     odd      3*1 + 1        4
2     even    A035327(2)      1
3     odd      3*3 + 1       10
4     even    A035327(4)      3
5     odd      3*5 + 1       16
		

Crossrefs

Programs

  • Python
    def A348074(n):
        if n%2==0:
            if n==0: return 1
            else: return (1<A035327(n)
        else: return 3*n+1
    
  • Python
    def A348074(n): return 3*n+1 if n&1 or n==0 else (~n)^(-1<Chai Wah Wu, Dec 20 2022

A323064 Squares whose binary complement (A035327) is a cube.

Original entry on oeis.org

0, 1, 36, 100, 484, 131044
Offset: 1

Views

Author

Alex Ratushnyak, Jan 03 2019

Keywords

Comments

Square roots: 0, 1, 6, 10, 22, 362.

Examples

			The binary complement of 100 is 27. Because 27 is a cube, 100 is in the sequence.
		

Crossrefs

Programs

  • PARI
    isok(n) = n == 0 || (issquare(n) && ispower(2^(1+logint(n, 2))-1-n, 3))
    for (n=0, 500, if (isok(n^2), print1(n^2, ", "))); \\ Michel Marcus, Jan 04 2019

A323067 Primes whose binary complement (A035327) is a square.

Original entry on oeis.org

2, 3, 7, 11, 31, 47, 59, 127, 191, 239, 251, 367, 827, 1019, 1471, 1723, 2011, 2939, 4079, 4091, 4591, 6427, 7867, 8191, 10607, 11483, 12539, 13679, 13883, 14447, 14783, 14939, 15227, 15359, 16127, 16187, 16319, 18367, 26683, 27583, 28411, 29167, 29851, 32191
Offset: 1

Views

Author

Alex Ratushnyak, Jan 03 2019

Keywords

Crossrefs

Programs

  • Mathematica
    Select[Prime@ Range[10^4], IntegerQ@ Sqrt@ FromDigits[IntegerDigits[#, 2] /. {0 -> 1, 1 -> 0}, 2] &] (* Michael De Vlieger, Jan 04 2019 *)
  • PARI
    bc(n) = bitxor(n, 2^(1+logint(max(n, 1), 2))-1); \\ A035327
    isok(n) = isprime(n) && issquare(bc(n)); \\ Michel Marcus, Jan 04 2019
Showing 1-10 of 74 results. Next