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 50 results. Next

A276008 Substitute ones for all nonzero digits in factorial base representation of n: a(n) = A059590(A275727(n)).

Original entry on oeis.org

0, 1, 2, 3, 2, 3, 6, 7, 8, 9, 8, 9, 6, 7, 8, 9, 8, 9, 6, 7, 8, 9, 8, 9, 24, 25, 26, 27, 26, 27, 30, 31, 32, 33, 32, 33, 30, 31, 32, 33, 32, 33, 30, 31, 32, 33, 32, 33, 24, 25, 26, 27, 26, 27, 30, 31, 32, 33, 32, 33, 30, 31, 32, 33, 32, 33, 30, 31, 32, 33, 32, 33, 24, 25, 26, 27, 26, 27, 30, 31, 32, 33, 32, 33, 30, 31, 32, 33, 32, 33, 30, 31, 32, 33, 32, 33, 24
Offset: 0

Views

Author

Antti Karttunen, Aug 18 2016

Keywords

Examples

			For n=23 whose factorial base representation is "321", when we replace each nonzero digit with 1, we get "111", the factorial base representation of 9, thus a(23) = 9.
From n=37 ("1201") we get "1101", thus a(37) = 31 as A007623(31) = 1101.
		

Crossrefs

Cf. also A276009.

Programs

  • Mathematica
    a[n_] := Module[{k = n, m = 2, r, s = {}}, While[{k, r} = QuotientRemainder[k, m]; k != 0|| r != 0, AppendTo[s, r]; m++]; s = Min[#, 1]& /@ s; Total[s*Range[Length[s]]!]]; Array[a, 100, 0] (* Amiram Eldar, Feb 14 2024 *)
  • Python
    from sympy import factorial as f
    def a007623(n, p=2): return n if n

    0 else '0' for i in x)[::-1] return sum([int(y[i])*f(i + 1) for i in range(len(y))]) print([a(n) for n in range(201)]) # Indranil Ghosh, Jun 21 2017

  • Scheme
    (define (A276008 n) (A059590 (A275727 n)))
    ;; Standalone program:
    (define (A276008 n) (let loop ((n n) (s 0) (f 1) (i 2)) (if (zero? n) s (let ((d (modulo n i))) (if (zero? d) (loop (/ n i) s (* i f) (+ 1 i)) (loop (/ (- n d) i) (+ s f) (* i f) (+ 1 i)))))))
    

Formula

a(n) = A059590(A275727(n)).

A377021 Numbers whose prime factorization has exponents that are all sums of distinct factorials (A059590, where 0! and 1! are not considered distinct).

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71
Offset: 1

Views

Author

Amiram Eldar, Oct 13 2024

Keywords

Comments

First differs from its subsequence A046100 at n = 61: a(61) = 64 is not a term of A046100.
Numbers k such that A376885(k) = A376886(k).
Numbers that are "squarefree" when they are factorized into factors of the form p^(k!), where p is a prime and k >= 1, a factorization that is done using the factorial-base representation of the exponents in the prime factorization (see A376885 for more details). Each factor p^(k!) has a multiplicity 1.
The asymptotic density of this sequence is Product_{p prime} (1 - 1/p^2 + (1 - 1/p) * (Sum_{k>=2} 1/p^A059590(k))) = 0.93973112474919498992... .

Crossrefs

Programs

  • Mathematica
    expQ[n_] := expQ[n] = Module[{k = n, m = 2, r, s = 1}, While[{k, r} = QuotientRemainder[k, m]; k != 0 || r != 0, If[r > 1, s = 0; Break[]]; m++]; s == 1]; q[n_] := AllTrue[FactorInteger[n][[;;, 2]], expQ]; Select[Range[100], q]
  • PARI
    isexp(n) = {my(k = n, m = 2, r); while([k, r] = divrem(k, m); k != 0 || r != 0, if(r > 1, return(0)); m++); 1;}
    is(k) = {my(e = factor(k)[, 2]); for(i = 1, #e, if(!isexp(e[i]), return(0))); 1;}

A064637 Setwise difference of A060132 and A059590. Those terms of A060132 which are not representable as a sum of distinct factorials.

Original entry on oeis.org

16, 17, 40, 41, 60, 61, 62, 63, 136, 137, 160, 161, 180, 181, 182, 183, 288, 289, 290, 291, 294, 295, 296, 297, 304, 305, 316, 317, 450, 451, 452, 453, 736, 737, 760, 761, 780, 781, 782, 783, 856, 857, 880, 881, 900, 901, 902, 903, 1008, 1009, 1010, 1011
Offset: 0

Views

Author

Antti Karttunen, Oct 02 2001

Keywords

Comments

16 is included, as 16 = 220 in factorial base and by following the algorithm PermRevLexUnrankAMSD in A055089 we get the composition (2 3)(3 4) (1 2)(2 3) which, although consisting of different transpositions, is equal to the composition (4 2)(3 1) = 3412 produced by algorithm PermUnrank3R at A060117.

Crossrefs

A064637 := list_diff(A060132, A059590),
Cf. A064477.

Programs

  • Maple
    list_diff := proc(a,b) local c,e; c := []; for e in a do if(not member(e,b)) then c := [op(c),e]; fi; od; RETURN(c); end;

A029931 If 2n = Sum 2^e_i, a(n) = Sum e_i.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

Write n in base 2, n = sum b(i)*2^(i-1), then a(n) = sum b(i)*i. - Benoit Cloitre, Jun 09 2002
May be regarded as a triangular array read by rows, giving weighted sum of compositions in standard order. The standard order of compositions is given by A066099. - Franklin T. Adams-Watters, Nov 06 2006
Sum of all positive integer roots m_i of polynomial {m,k} - see link [Shevelev]; see also A264613. - Vladimir Shevelev, Dec 13 2015
Also the sum of binary indices of n, where a binary index of n (A048793) is any position of a 1 in its reversed binary expansion. For example, the binary indices of 11 are {1,2,4}, so a(11) = 7. - Gus Wiseman, May 22 2024

Examples

			14 = 8+4+2 so a(7) = 3+2+1 = 6.
Composition number 11 is 2,1,1; 1*2+2*1+3*1 = 7, so a(11) = 7.
The triangle starts:
  0
  1
  2 3
  3 4 5 6
The reversed binary expansion of 18 is (0,1,0,0,1) with 1's at positions {2,5}, so a(18) = 2 + 5 = 7. - _Gus Wiseman_, Jul 22 2019
		

Crossrefs

Other sequences that are built by replacing 2^k in the binary representation with other numbers: A022290 (Fibonacci), A059590 (factorials), A073642, A089625 (primes), A116549, A326031.
Cf. A001793 (row sums), A011782 (row lengths), A059867, A066099, A124757.
Row sums of A048793 and A272020.
Contains exactly A000009(n) copies of n.
For length instead of sum we have A000120, complement A023416.
For minimum instead of sum we have A001511, opposite A000012.
For maximum instead of sum we have A029837 or A070939, opposite A070940.
For product instead of sum we have A096111.
The reverse version is A230877, row sums of A371572.
The reverse complement is A359359, row sums of A371571.
The complement is A359400, row sums of A368494.
Numbers k such that a(k) is prime are A372689.
A014499 lists binary indices of prime numbers.
A019565 gives Heinz number of binary indices, inverse A048675.
A372471 lists binary indices of primes, row-sums A372429.

Programs

  • Haskell
    a029931 = sum . zipWith (*) [1..] . a030308_row
    -- Reinhard Zumkeller, Feb 28 2014
    
  • Maple
    HammingWeight := n -> add(i, i = convert(n, base, 2)):
    a := proc(n) option remember; `if`(n = 0, 0,
    ifelse(n::even, a(n/2) + HammingWeight(n/2), a(n-1) + 1)) end:
    seq(a(n), n = 0..78); # Peter Luschny, Oct 30 2021
  • Mathematica
    a[n_] := (b = IntegerDigits[n, 2]).Reverse @ Range[Length @ b]; Array[a,78,0] (* Jean-François Alcover, Apr 28 2011, after B. Cloitre *)
  • PARI
    for(n=0,100,l=length(binary(n)); print1(sum(i=1,l, component(binary(n),i)*(l-i+1)),","))
    
  • PARI
    a(n) = my(b=binary(n)); b*-[-#b..-1]~; \\ Ruud H.G. van Tol, Oct 17 2023
    
  • Python
    def A029931(n): return sum(i if j == '1' else 0 for i, j in enumerate(bin(n)[:1:-1],1)) # Chai Wah Wu, Dec 20 2022
    (C#)
    ulong A029931(ulong n) {
        ulong result = 0, counter = 1;
        while(n > 0) {
            if (n % 2 == 1)
              result += counter;
            counter++;
            n /= 2;
        }
        return result;
    } // Frank Hollstein, Jan 07 2023

Formula

a(n) = a(n - 2^L(n)) + L(n) + 1 [where L(n) = floor(log_2(n)) = A000523(n)] = sum of digits of A048794 [at least for n < 512]. - Henry Bottomley, Mar 09 2001
a(0) = 0, a(2n) = a(n) + e1(n), a(2n+1) = a(2n) + 1, where e1(n) = A000120(n). a(n) = log_2(A029930(n)). - Ralf Stephan, Jun 19 2003
G.f.: (1/(1-x)) * Sum_{k>=0} (k+1)*x^2^k/(1+x^2^k). - Ralf Stephan, Jun 23 2003
a(n) = Sum_{k>=0} A030308(n,k)*A000027(k+1). - Philippe Deléham, Oct 15 2011
a(n) = sum of n-th row of the triangle in A213629. - Reinhard Zumkeller, Jun 17 2012
From Reinhard Zumkeller, Feb 28 2014: (Start)
a(A089633(n)) = n and a(m) != n for m < A089633(n).
a(n) = Sum_{k=1..A070939(n)} k*A030308(n,k-1). (End)
a(n) = A073642(n) + A000120(n). - Peter Kagey, Apr 04 2016

Extensions

More terms from Erich Friedman

A225901 Write n in factorial base, then replace each nonzero digit d of radix k with k-d.

Original entry on oeis.org

0, 1, 4, 5, 2, 3, 18, 19, 22, 23, 20, 21, 12, 13, 16, 17, 14, 15, 6, 7, 10, 11, 8, 9, 96, 97, 100, 101, 98, 99, 114, 115, 118, 119, 116, 117, 108, 109, 112, 113, 110, 111, 102, 103, 106, 107, 104, 105, 72, 73, 76, 77, 74, 75, 90, 91, 94, 95, 92, 93, 84, 85, 88, 89, 86, 87, 78, 79, 82, 83, 80, 81, 48, 49, 52, 53, 50, 51, 66, 67, 70, 71, 68
Offset: 0

Views

Author

Paul Tek, May 20 2013

Keywords

Comments

Analogous to A004488 or A048647 for the factorial base.
A self-inverse permutation of the natural numbers.
From Antti Karttunen, Aug 16-29 2016: (Start)
Consider the following way to view a factorial base representation of nonnegative integer n. For each nonzero digit d_i present in the factorial base representation of n (where i is the radix = 2.. = one more than 1-based position from the right), we place a pebble to the level (height) d_i at the corresponding column i of the triangular diagram like below, while for any zeros the corresponding columns are left empty:
.
Level
6 o
─ ─
5 . .
─ ─ ─
4 . . .
─ ─ ─ ─
3 . . . .
─ ─ ─ ─ ─
2 . . o . .
─ ─ ─ ─ ─ ─
1 . o . . o o
─ ─ ─ ─ ─ ─ ─
Radix: 7 6 5 4 3 2
Digits: 6 1 2 0 1 1 = A007623(4491)
Instead of levels, we can observe on which "slope" each pebble (nonzero digit) is located at. Formally, the slope of nonzero digit d_i with radix i is (i - d_i). Thus in above example, both the most significant digit (6) and the least significant 1 are on slope 1 (called "maximal slope", because it contains digits that are maximal allowed in those positions), while the second 1 from the right is on slope 2 ("submaximal slope").
This involution (A225901) sends each nonzero digit at level k to the slope k (and vice versa) by flipping such a diagram by the shallow diagonal axis that originates from the bottom right corner. Thus, from above diagram we obtain:
Slope (= digit's radix - digit's value)
1
2 .
3 . .╲
4 . .╲o╲
5 . .╲.╲.╲
6 . .╲.╲o╲.╲
. .╲.╲.╲.╲o╲
o╲.╲.╲.╲.╲o╲
-----------------
1 5 3 0 2 1 = A007623(1397)
and indeed, a(4491) = 1397 and a(1397) = 4491.
Thus this permutation maps between polynomial encodings A275734 & A275735 and all the respective sequences obtained from them, where the former set of sequences are concerned with the "slopes" and the latter set with the "levels" of the factorial base representation. See the Crossrefs section.
Sequences A231716 and A275956 are closed with respect to this sequence, in other words, for all n, a(A231716(n)) is a term of A231716 and a(A275956(n)) is a term of A275956.
(End)

Examples

			a(1000) = a(1*6! + 2*5! + 1*4! + 2*3! + 2*2!) = (7-1)*6! + (6-2)*5! + (5-1)*4! + (4-2)*3! + (3-2)*2! = 4910.
a(1397) = a(1*6! + 5*5! + 3*4! + 0*3! + 2*2! + 1*1!) = (7-1)*6! + (6-5)*5! + (5-3)*4! + (3-2)*2! + (2-1)*1! = 4491.
		

Crossrefs

Cf. A275959 (fixed points), A231716, A275956.
This involution maps between the following sequences related to "levels" and "slopes" (see comments): A275806 <--> A060502, A257511 <--> A260736, A264990 <--> A275811, A275729 <--> A275728, A275948 <--> A275946, A275949 <--> A275947, A275964 <--> A275962, A059590 <--> A276091.

Programs

  • Mathematica
    b = MixedRadix[Reverse@ Range[2, 12]]; Table[FromDigits[Map[Boole[# > 0] &, #] (Reverse@ Range[2, Length@ # + 1] - #), b] &@ IntegerDigits[n, b], {n, 0, 82}] (* Version 10.2, or *)
    f[n_] := Block[{a = {{0, n}}}, Do[AppendTo[a, {First@ #, Last@ #} &@ QuotientRemainder[a[[-1, -1]], Times @@ Range[# - i]]], {i, 0, #}] &@ NestWhile[# + 1 &, 0, Times @@ Range[# + 1] <= n &]; Most@ Rest[a][[All, 1]] /. {} -> {0}]; g[w_List] := Total[Times @@@ Transpose@ {Map[Times @@ # &, Range@ Range[0, Length@ w]], Reverse@ Append[w, 0]}]; Table[g[Map[Boole[# > 0] &, #] (Reverse@ Range[2, Length@ # + 1] - #)] &@ f@ n, {n, 0, 82}] (* Michael De Vlieger, Aug 29 2016 *)
  • PARI
    a(n)=my(s=0,d,k=2);while(n,d=n%k;n=n\k;if(d,s=s+(k-d)*(k-1)!);k=k+1);return(s)
    
  • Python
    from sympy import factorial as f
    def a(n):
        s=0
        k=2
        while(n):
            d=n%k
            n=(n//k)
            if d: s=s+(k - d)*f(k - 1)
            k+=1
        return s
    print([a(n) for n in range(101)]) # Indranil Ghosh, Jun 19 2017
  • Scheme
    (define (A225901 n) (let loop ((n n) (z 0) (m 2) (f 1)) (cond ((zero? n) z) (else (loop (quotient n m) (if (zero? (modulo n m)) z (+ z (* f (- m (modulo n m))))) (+ 1 m) (* f m))))))
    ;; One implementing the first recurrence, with memoization-macro definec:
    (definec (A225901 n) (if (zero? n) n (+ (A276091 (A275736 n)) (A153880 (A225901 (A257684 n))))))
    ;; Antti Karttunen, Aug 29 2016
    

Formula

From Antti Karttunen, Aug 29 2016: (Start)
a(0) = 0; for n >= 1, a(n) = A276091(A275736(n)) + A153880(a(A257684(n))).
or, for n >= 1, a(n) = A276149(n) + a(A257687(n)).
(End)
Other identities. For n >= 0:
a(n!) = A001563(n).
a(n!-1) = A007489(n-1).
From Antti Karttunen, Aug 16 2016: (Start)
A275734(a(n)) = A275735(n) and vice versa, A275735(a(n)) = A275734(n).
A060130(a(n)) = A060130(n). [The flip preserves the number of nonzero digits.]
A153880(n) = a(A255411(a(n))) and A255411(n) = a(A153880(a(n))). [This involution conjugates between the two fundamental factorial base shifts.]
a(n) = A257684(a(A153880(n))) = A266193(a(A255411(n))). [Follows from above.]
A276011(n) = A273662(a(A273670(n))).
A276012(n) = A273663(a(A256450(n))).
(End)

A276156 Numbers obtained by reinterpreting base-2 representation of n in primorial base: a(0) = 0, a(2n) = A276154(a(n)), a(2n+1) = 1 + A276154(a(n)).

Original entry on oeis.org

0, 1, 2, 3, 6, 7, 8, 9, 30, 31, 32, 33, 36, 37, 38, 39, 210, 211, 212, 213, 216, 217, 218, 219, 240, 241, 242, 243, 246, 247, 248, 249, 2310, 2311, 2312, 2313, 2316, 2317, 2318, 2319, 2340, 2341, 2342, 2343, 2346, 2347, 2348, 2349, 2520, 2521, 2522, 2523, 2526, 2527, 2528, 2529, 2550, 2551, 2552, 2553, 2556, 2557, 2558, 2559, 30030, 30031
Offset: 0

Views

Author

Antti Karttunen, Aug 24 2016

Keywords

Comments

Numbers that are sums of distinct primorial numbers, A002110.
Numbers with no digits larger than one in primorial base, A049345.

Crossrefs

Complement of A177711.
Subsequences: A328233, A328832, A328462 (odd bisection).
Conjectured subsequences: A328110, A380527.
Fixed points of A328841, positions of zeros in A328828, A328842, and A329032, positions of ones in A328581, A328582, and A381032.
Positions of terms < 2 in A328114.
Indices where A327860 and A329029 coincide.
Cf. also table A328464 (and its rows).

Programs

  • Mathematica
    nn = 65; b = MixedRadix[Reverse@ Prime@ Range[IntegerLength[nn, 2] - 1]]; Table[FromDigits[IntegerDigits[n, 2], b], {n, 0, 65}] (* Version 10.2, or *)
    Table[Total[Times @@@ Transpose@ {Map[Times @@ # &, Prime@ Range@ Range[0, Length@ # - 1]], Reverse@ #}] &@ IntegerDigits[n, 2], {n, 0, 65}] (* Michael De Vlieger, Aug 26 2016 *)
  • PARI
    A276156(n) = { my(s=0, p=1, r=1); while(n, if(n%2, s += r); n>>=1; p = nextprime(1+p); r *= p); (s); }; \\ Antti Karttunen, Feb 03 2022
  • Python
    from sympy import prime, primorial, primepi, factorint
    from operator import mul
    def a002110(n): return 1 if n<1 else primorial(n)
    def a276085(n):
        f=factorint(n)
        return sum([f[i]*a002110(primepi(i) - 1) for i in f])
    def a019565(n): return reduce(mul, (prime(i+1) for i, v in enumerate(bin(n)[:1:-1]) if v == '1')) # after Chai Wah Wu
    def a(n): return 0 if n==0 else a276085(a019565(n))
    print([a(n) for n in range(101)]) # Indranil Ghosh, Jun 23 2017
    

Formula

a(0) = 0, a(2n) = A276154(a(n)), a(2n+1) = 1+A276154(a(n)).
Other identities. For all n >= 0:
a(n) = A276085(A019565(n)).
A049345(a(n)) = A007088(n).
A257993(a(n)) = A001511(n).
A276084(a(n)) = A007814(n).
A051903(a(n)) = A351073(n).

A276076 Factorial base exp-function: digits in factorial base representation of n become the exponents of successive prime factors whose product a(n) is.

Original entry on oeis.org

1, 2, 3, 6, 9, 18, 5, 10, 15, 30, 45, 90, 25, 50, 75, 150, 225, 450, 125, 250, 375, 750, 1125, 2250, 7, 14, 21, 42, 63, 126, 35, 70, 105, 210, 315, 630, 175, 350, 525, 1050, 1575, 3150, 875, 1750, 2625, 5250, 7875, 15750, 49, 98, 147, 294, 441, 882, 245, 490, 735, 1470, 2205, 4410, 1225, 2450, 3675, 7350, 11025, 22050, 6125, 12250, 18375, 36750, 55125, 110250, 343
Offset: 0

Views

Author

Antti Karttunen, Aug 18 2016

Keywords

Comments

These are prime-factorization representations of single-variable polynomials where the coefficient of term x^(k-1) (encoded as the exponent of prime(k) in the factorization of n) is equal to the digit in one-based position k of the factorial base representation of n. See the examples.

Examples

			   n  A007623   polynomial     encoded as             a(n)
   -------------------------------------------------------
   0       0    0-polynomial   (empty product)        = 1
   1       1    1*x^0          prime(1)^1             = 2
   2      10    1*x^1          prime(2)^1             = 3
   3      11    1*x^1 + 1*x^0  prime(2) * prime(1)    = 6
   4      20    2*x^1          prime(2)^2             = 9
   5      21    2*x^1 + 1*x^0  prime(2)^2 * prime(1)  = 18
   6     100    1*x^2          prime(3)^1             = 5
   7     101    1*x^2 + 1*x^0  prime(3) * prime(1)    = 10
and:
  23     321  3*x^2 + 2*x + 1  prime(3)^3 * prime(2)^2 * prime(1)
                                      = 5^3 * 3^2 * 2 = 2250.
		

Crossrefs

Cf. A276075 (a left inverse).
Cf. A276078 (same terms in ascending order).
Cf. also A275733, A275734, A275735, A275725 for other such encodings of factorial base related polynomials, and A276086 for a primorial base analog.

Programs

  • Mathematica
    a[n_] := Module[{k = n, m = 2, r, p = 2, q = 1}, While[{k, r} = QuotientRemainder[k, m]; k != 0|| r != 0, q *= p^r; p = NextPrime[p]; m++]; q]; Array[a, 100, 0] (* Amiram Eldar, Feb 07 2024 *)

Formula

a(0) = 1, for n >= 1, a(n) = A275733(n) * a(A276009(n)).
Or: for n >= 1, a(n) = a(A257687(n)) * A000040(A084558(n))^A099563(n).
Other identities.
For all n >= 0:
A276075(a(n)) = n.
A001221(a(n)) = A060130(n).
A001222(a(n)) = A034968(n).
A051903(a(n)) = A246359(n).
A048675(a(n)) = A276073(n).
A248663(a(n)) = A276074(n).
a(A007489(n)) = A002110(n).
a(A059590(n)) = A019565(n).
For all n >= 1:
a(A000142(n)) = A000040(n).
a(A033312(n)) = A076954(n-1).
From Antti Karttunen, Apr 18 2022: (Start)
a(n) = A276086(A351576(n)).
A276085(a(n)) = A351576(n)
A003557(a(n)) = A351577(n).
A003415(a(n)) = A351950(n).
A069359(a(n)) = A351951(n).
A083345(a(n)) = A342001(a(n)) = A351952(n).
A351945(a(n)) = A351954(n).
A181819(a(n)) = A275735(n).
(End)
lambda(a(n)) = A262725(n+1), where lambda is Liouville's function, A008836. - Antti Karttunen and Peter Munn, Aug 09 2024

Extensions

Name changed by Antti Karttunen, Apr 18 2022

A022290 Replace 2^k in binary expansion of n with Fibonacci(k+2).

Original entry on oeis.org

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

Views

Author

Keywords

Examples

			n=4 = 2^2 is replaced by A000045(2+2) = 3. n=5 = 2^2 + 2^0 is replaced by A000045(2+2) + A000045(0+2) = 3+1 = 4. - _R. J. Mathar_, Jan 31 2015
From _Philippe Deléham_, Jun 05 2015: (Start)
This sequence regarded as a triangle with rows of lengths 1, 1, 2, 4, 8, 16, ...:
  0
  1
  2, 3
  3, 4, 5, 6
  5, 6, 7, 8, 8, 9, 10, 11
  8, 9, 10, 11, 11, 12, 13, 14, 13, 14, 15, 16, 16, 17, 18, 19
  ...
(End)
		

Crossrefs

Other sequences that are built by replacing 2^k in the binary representation with other numbers: A029931 (naturals), A054204 (even-indexed Fibonacci numbers), A062877 (odd-indexed Fibonacci numbers), A059590 (factorials), A089625 (primes).

Programs

  • Haskell
    a022290 0 = 0
    a022290 n = h n 0 $ drop 2 a000045_list where
       h 0 y _      = y
       h x y (f:fs) = h x' (y + f * r) fs where (x',r) = divMod x 2
    -- Reinhard Zumkeller, Oct 03 2012
    
  • Maple
    A022290 := proc(n)
        dgs := convert(n,base,2) ;
        add( op(i,dgs)*A000045(i+1),i=1..nops(dgs)) ;
    end proc: # R. J. Mathar, Jan 31 2015
    # second Maple program:
    b:= (n, i, j)-> `if`(n=0, 0, j*irem(n, 2, 'q')+b(q, j, i+j)):
    a:= n-> b(n, 1$2):
    seq(a(n), n=0..127);  # Alois P. Heinz, Jan 26 2022
  • Mathematica
    Table[Reverse[#].Fibonacci[1 + Range[Length[#]]] &@ IntegerDigits[n, 2], {n, 0, 54}] (* IWABUCHI Yu(u)ki, Aug 01 2012 *)
  • PARI
    my(m=Mod('x,'x^2-'x-1)); a(n) = subst(lift(subst(Pol(binary(n)), 'x,m)), 'x,2); \\ Kevin Ryde, Sep 22 2020
    
  • Python
    def A022290(n):
        a, b, s = 1,2,0
        for i in bin(n)[-1:1:-1]:
            s += int(i)*a
            a, b = b, a+b
        return s # Chai Wah Wu, Sep 10 2022

Formula

G.f.: (1/(1-x)) * Sum_{k>=0} F(k+2)*x^2^k/(1+x^2^k), where F = A000045.
a(n) = Sum_{k>=0} A030308(n,k)*A000045(k+2). - Philippe Deléham, Oct 15 2011
a(A003714(n)) = n. - R. J. Mathar, Jan 31 2015
a(A000225(n)) = A001911(n). - Philippe Deléham, Jun 05 2015
From Jeffrey Shallit, Jul 17 2018: (Start)
Can be computed from the recurrence:
a(4*k) = a(k) + a(2*k),
a(4*k+1) = a(k) + a(2*k+1),
a(4*k+2) = a(k) - a(2*k) + 2*a(2*k+1),
a(4*k+3) = a(k) - 2*a(2*k) + 3*a(2*k+1),
and the initial terms a(0) = 0, a(1) = 1. (End)
a(A003754(n)) = n-1. - Rémy Sigrist, Jan 28 2020
From Rémy Sigrist, Aug 04 2022: (Start)
Empirically:
- a(2*A003714(n)) = A022342(n+1),
- a(3*A003714(n)) = a(4*A003714(n)) = A026274(n) for n > 0.
(End)

A256450 Numbers that have at least one 1-digit in their factorial base representation (A007623).

Original entry on oeis.org

1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 13, 14, 15, 17, 19, 20, 21, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 49, 50, 51, 53, 54, 55, 56, 57, 58, 59, 61, 62, 63, 65, 67, 68, 69, 71, 73, 74, 75, 77, 78, 79, 80, 81, 82, 83, 85, 86, 87, 89, 91, 92, 93, 95, 97, 98, 99, 101
Offset: 0

Views

Author

Antti Karttunen, Apr 27 2015

Keywords

Comments

Numbers n for which A257679(n) = 1, i.e., numbers n such that the least nonzero digit in their factorial base representation (A007623) is 1.
Involution A225901 maps each term of this sequence to a unique term of A273670, and vice versa.
Starting offset is zero (with a(0) = 1) because it is the most natural offset for the given fast recurrence.

Crossrefs

Complement of A255411.
Cf. A257680 (characteristic function), A273662 (left inverse).
First row of A257503, first column of A257505.
Subsequences: A059590 (apart from its zero-term), A255341, A255342, A255343, A257262, A257263, A258198, A258199.
Cf. also A227187 (numbers with at least one nonleading zero) and A273670, A225901.

Programs

  • Mathematica
    Select[Range@ 101, MemberQ[IntegerDigits[#, MixedRadix[Reverse@ Range@ 12]], 1] &] (* Michael De Vlieger, May 30 2016, Version 10.2 *)
    r = MixedRadix[Reverse@ Range[2, 12]]; Select[Range@ 101, Min[IntegerDigits[#, r] /. 0 -> Nothing] == 1 &]  (* Michael De Vlieger, Aug 14 2016, Version 10.2 *)
  • Python
    def A(n, p=2): return n if n

    =1]) # Indranil Ghosh, Jun 19 2017

Formula

a(0) = 1, and for n >= 1, if A257511(1+a(n-1)) > 0, then a(n) = a(n-1) + 1, otherwise a(n-1) + 2. [In particular, if the previous term is 2k, then the next term is 2k+1, because all odd numbers are members.]
Other identities:
For all n >= 0, A273662(a(n)) = n. [A273662 works as the left inverse for this sequence.]
From Antti Karttunen, May 26 2015: (Start)
Alternative recurrence for the same sequence:
Set k = A258198(n), d = n - A258199(n) and f = A000142(k+1) = (k+1)! If d < f then b(n) = f+d, otherwise b(n) = ((2+floor((d-f)/A258199(n))) * f) + b((d-f) mod A258199(n)). For offset=1 sequence, define a(n) = b(n-1).
(End)

Extensions

Starting offset changed from 1 to 0 by Antti Karttunen, May 30 2016

A257684 Discard the rightmost digit from the factorial base representation of n and subtract one from all remaining nonzero digits, then convert back to decimal.

Original entry on oeis.org

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

Views

Author

Antti Karttunen, May 04 2015

Keywords

Comments

In other words, subtract one from all nonzero digits in the factorial base representation (A007623) of n and shift it one step right (i.e., delete the rightmost zero), then convert back to decimal.

Examples

			For 4, whose factorial base representation is "20" (as 4 = 2*2! + 0*1!), when we discard the rightmost zero, and subtract 1 from 2, we get "1", thus a(4) = 1.
For 18, whose factorial base representation is "300" (as 18 = 3*3! + 0*2! + 0*1!), when we discard the rightmost zero, and subtract 1 from 3, we get "20", thus a(18) = 4.
		

Crossrefs

Positions of zeros: A059590.
Can be used to define simple recurrences for sequences like A034968, A246359, A257679, A257694, A257695 and A257696.

Programs

  • Mathematica
    nn = 95; m = 1; While[Factorial@ m < nn, m++]; m; Map[FromDigits[#, MixedRadix[Reverse@ Range[2, m]]] &[If[# == 0, 0, # - 1] & /@ Most@ IntegerDigits[#, MixedRadix[Reverse@ Range[2, m]]]] &, Range[0, nn]] (* Michael De Vlieger, Aug 11 2016, Version 10.2 *)
  • Python
    from sympy import factorial as f
    def a007623(n, p=2):
        return n if n

    0 else '0' for i in x)[::-1] return 0 if n==1 else sum(int(y[i])*f(i + 1) for i in range(len(y))) print([a(n) for n in range(101)]) # Indranil Ghosh, Jun 19 2017

  • Scheme
    (define (A257684 n) (let loop ((n n) (z 0) (i 2) (f 0)) (cond ((zero? n) z) (else (let ((d (remainder n i))) (loop (quotient n i) (+ z (* f (- d (if (zero? d) 0 1)))) (+ 1 i) (if (zero? f) 1 (* f (- i 1)))))))))
    

Formula

For all n >= 0, a(A255411(n)) = n. [This sequence works as a left inverse of A255411. See A257685 for a "cleaned up" version.]
Showing 1-10 of 50 results. Next