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-2 of 2 results.

A325804 Positions of nonzero terms of Product_{k=0..floor(log_2(n))} (1 + A004718(floor(n/(2^k)))).

Original entry on oeis.org

0, 1, 3, 6, 7, 12, 14, 15, 24, 25, 28, 29, 30, 31, 48, 50, 51, 56, 57, 58, 60, 61, 62, 63, 96, 97, 100, 101, 102, 103, 112, 113, 114, 115, 116, 117, 120, 121, 122, 123, 124, 125, 126, 127, 192, 194, 195, 200, 201, 202, 204, 205, 206, 207, 224, 225, 226, 228
Offset: 1

Views

Author

Mikhail Kurkov, May 22 2019

Keywords

Crossrefs

Programs

  • Mathematica
    a[n_?EvenQ] := a[n] = -a[n/2]; a[0] = 0; a[n_] := a[n] = a[(n - 1)/2] + 1; -1 + Position[Table[Product[ 1 + a[Floor[n/(2^k)]], {k, 0, Floor[Log2[n]]}], {n, 0, 500}], ?(# != 0 &)][[All, 1]] (* _Michael De Vlieger, Apr 22 2024, after Jean-François Alcover at A004718 *)
  • PARI
    b(n) = if(n==0, 0, (-1)^(n+1)*b(n\2) + n%2); \\ A004718
    f(n) = if(n==0, 1, prod(k=0, logint(n,2), 1+b(n\2^k)));
    isok(n) = f(n)!=0; \\ Michel Marcus, May 24 2019
    
  • Python
    from itertools import count, islice
    def A325804_gen(startvalue=0): # generator of terms >= startvalue
        for n in count(max(startvalue,0)):
            c, s = [0]*(m:=n.bit_length()), bin(n)[2:]
            for i in range(m):
                if s[i]=='1':
                    for j in range(m-i):
                        c[j] = c[j]+1
                else:
                    for j in range(m-i):
                        c[j] = -c[j]
            if all(1+d for d in c): yield n
    A325804_list = list(islice(A325804_gen(),20)) # Chai Wah Wu, Mar 03 2023

Formula

Conjecture: a(n) - a(n-1) belongs to A094373. - Mikhail Kurkov, Feb 20 2021

A329893 a(n) = Product_{k=0..floor(log_2(n))} (1 + A004718(floor(n/(2^k)))), where A004718 is Per Nørgård's "infinity sequence".

Original entry on oeis.org

1, 2, 0, 6, 0, 0, -6, 24, 0, 0, 0, 0, -18, 0, -48, 120, 0, 0, 0, 0, 0, 0, 0, 0, 18, -72, 0, 0, -192, 48, -360, 720, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, 0, 144, -360, 0, 0, 0, 0, 384, -960, 144, 0, -1800, 720, -2880, 5040, 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, 0, -54, 216
Offset: 0

Views

Author

Antti Karttunen (after Mikhail Kurkov's A325803), Dec 10 2019 [verification needed]

Keywords

Comments

The composer Per Nørgård's name is also written in the OEIS as Per Noergaard.
From Mikhail Kurkov, May 22 2019 (comments originally given in A325803): (Start)
Number of positive terms on the interval 2^m <= n < 2^(m+1) for m > 0 equals f(m-1,2,1) (and f(m-1,4,3) for negative) with f(m,g,h) = binomial(m, floor(m/2) + floor((m+g)/4) - floor((m+h)/4)), so total number of nonzero terms equals binomial(m, floor(m/2)) = A001405(m).
Sum_{n=0..2^m-1} a(n) = 3^m, m >= 0.
More generally, if we define a(n,k) = (-1)^(n+1)*a(floor(n/k),k) + n mod k, a(0,k) = 0, so Sum_{n=0..k^m-1} Product_{i=0..floor(log_k(n))} (1 + a(floor(n/(k^i)),k)) = binomial(k+1, 2)^m for any k = 2p, p > 0.
(End) [verification needed]

Crossrefs

Cf. A001405, A004718, A325803 (nonzero terms), A325804 (their positions).
Cf. also A284005, A293233.

Programs

  • Mathematica
    f[n_?EvenQ] := f[n] = -f[n/2]; f[0] = 0; f[n_] := f[n] = f[(n - 1)/2] + 1; Table[Product[1 + f[Floor[n/(2^k)]], {k, 0, Floor[Log2[n]]}], {n, 0, 120}]  (* Michael De Vlieger, Apr 22 2024, after Jean-François Alcover at A004718 *)
  • PARI
    up_to = 65537;
    A004718list(up_to) = { my(v=vector(up_to)); v[1]=1; v[2]=-1; for(n=3, up_to, v[n] = if(n%2, 1+v[n>>1], -v[n/2])); (v); }; \\ After code in A004718.
    v004718 = A004718list(up_to);
    A004718(n) = if(!n,n,v004718[n]);
    A329893(n) = { my(m=1); while(n, m *= 1+A004718(n); n >>= 1); (m); };
    
  • Python
    from math import prod
    def A329893(n):
        c, s = [0]*(m:=n.bit_length()), bin(n)[2:]
        for i in range(m):
            if s[i]=='1':
                for j in range(m-i):
                    c[j] = c[j]+1
            else:
                for j in range(m-i):
                    c[j] = -c[j]
        return prod(1+d for d in c) # Chai Wah Wu, Mar 03 2023

Formula

a(0) = 1; for n > 1, a(n) = (1+A004718(n)) * a(floor(n/2)).
a(n) = Product_{k=0..floor(log_2(n))} (1 + A004718(floor(n/(2^k)))).
a(A325804(n)) = A325803(n).
Showing 1-2 of 2 results.