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 21-30 of 30 results.

A245608 Permutation of natural numbers, the even bisection of A245606 halved: a(n) = A245606(2*n)/2.

Original entry on oeis.org

1, 2, 3, 5, 4, 8, 13, 11, 6, 14, 18, 41, 7, 26, 28, 20, 9, 23, 63, 50, 25, 113, 313, 65, 12, 17, 88, 77, 172, 149, 43, 95, 16, 38, 33, 44, 10, 413, 163, 221, 19, 74, 48, 191, 22, 476, 118, 179, 49, 68, 138, 29, 39, 527, 78, 215, 31, 635, 1593, 227, 102, 71, 688, 242, 24, 122, 193, 104, 15, 98, 58, 176, 30, 32, 123
Offset: 1

Views

Author

Antti Karttunen, Jul 29 2014

Keywords

Crossrefs

Programs

Formula

a(n) = A245606(2*n)/2.
As a composition of related permutations:
a(n) = A048673(A245606(n)).
a(n) = A245708(A245706(n)).
Other identities:
For all n >= 0, a(2^n) = A245708(2^n). Moreover, A245709 gives all such k that a(k) = A245708(k).

A285712 a(1) = 0, and for n > 1, if n = 3k-1, then a(n) = k, otherwise a(n) = (A064216(n)+1)/2.

Original entry on oeis.org

0, 1, 2, 3, 2, 4, 6, 3, 7, 9, 4, 10, 5, 5, 12, 15, 6, 8, 16, 7, 19, 21, 8, 22, 13, 9, 24, 11, 10, 27, 30, 11, 17, 31, 12, 34, 36, 13, 18, 37, 14, 40, 20, 15, 42, 28, 16, 26, 45, 17, 49, 51, 18, 52, 54, 19, 55, 29, 20, 33, 25, 21, 14, 57, 22, 64, 43, 23, 66, 69, 24, 39, 35, 25, 70, 75, 26, 44, 76, 27, 48, 79, 28, 82, 61, 29, 84, 23, 30, 87, 90, 31, 47, 46, 32
Offset: 1

Views

Author

Antti Karttunen, Apr 25 2017

Keywords

Comments

For n >= 2, a(n) gives the contents of the parent node of the node containing n in binary trees like A245612.
Every positive integer greater than one occurs exactly twice in this sequence.

Crossrefs

Programs

  • Mathematica
    a[n_] := a[n] = Which[n == 1, 0, Mod[n, 3] == 2, Ceiling[n/3], True, (Times @@ Power[If[# == 1, 1, NextPrime[#, -1]] & /@ First@ #, Last@ #] &@ Transpose@ FactorInteger[2 n - 1] + 1)/2]; Array[a, 95] (* Michael De Vlieger, Sep 22 2017 *)
  • Scheme
    (define (A285712 n) (cond ((<= n 1) (- n 1)) ((= 2 (modulo n 3)) (A002264 (+ 1 n))) (else (/ (+ 1 (A064216 n)) 2))))

Formula

a(1) = 0, and for n > 1, if n = 3*k-1, then a(n) = k, otherwise a(n) = (A064216(n)+1)/2.
a(n) = (n+1)/3 + (3*A064216(n) - 2*n + 1)*( (n+1)^2 mod 3 )/6, for n>1. - Ammar Khatab, Sep 21 2020

A253786 a(3n) = 0, a(3n+1) = 0, a(3n+2) = 1 + a(n+1).

Original entry on oeis.org

0, 0, 1, 0, 0, 2, 0, 0, 1, 0, 0, 1, 0, 0, 3, 0, 0, 1, 0, 0, 1, 0, 0, 2, 0, 0, 1, 0, 0, 1, 0, 0, 2, 0, 0, 1, 0, 0, 1, 0, 0, 4, 0, 0, 1, 0, 0, 1, 0, 0, 2, 0, 0, 1, 0, 0, 1, 0, 0, 2, 0, 0, 1, 0, 0, 1, 0, 0, 3, 0, 0, 1, 0, 0, 1, 0, 0, 2, 0, 0, 1, 0, 0, 1, 0, 0, 2, 0, 0, 1, 0, 0, 1, 0, 0, 3, 0, 0, 1, 0, 0, 1, 0, 0, 2, 0, 0, 1, 0, 0, 1, 0, 0, 2, 0, 0, 1, 0, 0, 1, 0, 0, 5
Offset: 0

Views

Author

Antti Karttunen, Jan 22 2015

Keywords

Comments

For n >= 1, a(n) gives the distance of n in square array A191450 from its leftmost column.
The sequence 0,1,0,0,0,2,0,...,i.e., (a(n)) with the first term removed, is the unique fixed point of the constant length 3 morphism N -> 0 N+1 0 on the infinite alphabet {0,1,...,N,...}. - Michel Dekking, Sep 09 2022
a(n) is the number of trailing 1 digits of n-1 written in ternary, for n>=1. - Kevin Ryde, Sep 09 2022

Crossrefs

Programs

  • Mathematica
    With[{nmax=200},IntegerExponent[2Range[0,nmax]-1,3]] (* Paolo Xausa, Nov 09 2023 *)
  • PARI
    a(n) = n--; my(ret=0,r); while([n,r]=divrem(n,3); r==1, ret++); ret; \\ Kevin Ryde, Sep 13 2022

Formula

Other identities and observations. For all n >= 1:
a(n) = A254046(n)-1.
a(n) <= A254045(n) <= A253894(n).
a(3n-1) = A254046(n). - Cyril Damamme, Aug 04 2015
a(n) = A007949(2n-1), i.e., the 3-adic valuation of 2n-1. - Cyril Damamme, Aug 04 2015
From Antti Karttunen, Sep 12 2017: (Start)
For all n >= 1:
a(n) = A007814(A064216(n)) = A007814(A254104(n)) = A135523(A245611(n)).
a(A048673(n)) = a(A254103(n)) = A007814(n).
a(A244154(n)) = A007814(1+n).
a(A245612(n)) = A135523(n). (End)
Asymptotic mean: Limit_{m->oo} (1/m) * Sum_{k=1..m} a(k) = 1/2. - Amiram Eldar, Nov 16 2023

A275716 Permutation of natural numbers: a(0) = 1, a(1) = 2, a(2n) = A273669(a(n)), a(2n+1) = A273664(a(n)).

Original entry on oeis.org

1, 2, 9, 3, 42, 17, 12, 4, 209, 115, 82, 41, 59, 26, 19, 5, 1042, 801, 572, 444, 409, 283, 202, 57, 292, 180, 129, 48, 92, 31, 22, 6, 5209, 5603, 4002, 4881, 2859, 3106, 2219, 733, 2042, 1977, 1412, 620, 1009, 395, 282, 97, 1459, 1258, 899, 525, 642, 334, 239, 74, 459, 213, 152, 63, 109, 40, 29, 7, 26042, 39217
Offset: 0

Views

Author

Antti Karttunen, Aug 06 2016

Keywords

Comments

Note the indexing: the domain starts from 0, while the range excludes zero.
This sequence can be represented as a binary tree. Each left hand child is obtained by applying A273669(n) when the parent contains n, and each right hand child is obtained by applying A273664 to the parent's contents:
1
|
...................2...................
9 3
42......../ \........17 12......../ \........4
/ \ / \ / \ / \
/ \ / \ / \ / \
/ \ / \ / \ / \
209 115 82 41 59 26 19 5
1042 801 572 444 409 283 202 57 292 180 129 48 92 31 22 6
etc.

Crossrefs

Inverse: A275715.
Related or similar permutations: A163511, A249824, A245612.

Formula

a(0) = 1, a(1) = 2, a(2n) = A273669(a(n)), a(2n+1) = A273664(a(n)).
As a composition of other permutations:
a(n) = A249824(A163511(n)).

A364297 a(n) = A348717(A163511(n)).

Original entry on oeis.org

1, 2, 4, 2, 8, 4, 6, 2, 16, 8, 18, 4, 12, 6, 10, 2, 32, 16, 54, 8, 36, 18, 50, 4, 24, 12, 30, 6, 20, 10, 14, 2, 64, 32, 162, 16, 108, 54, 250, 8, 72, 36, 150, 18, 100, 50, 98, 4, 48, 24, 90, 12, 60, 30, 70, 6, 40, 20, 42, 10, 28, 14, 22, 2, 128, 64, 486, 32, 324, 162, 1250, 16, 216, 108, 750, 54, 500, 250, 686, 8, 144
Offset: 0

Views

Author

Antti Karttunen, Aug 15 2023

Keywords

Comments

For all i, j: a(i) = a(j) => A278531(i) = A278531(j).
As the underlying sequence A163511 can be represented as a binary tree, so can this be also:
1
|
...................2...................
4 2
8......../ \........4 6......../ \........2
/ \ / \ / \ / \
/ \ / \ / \ / \
/ \ / \ / \ / \
16 8 18 4 12 6 10 2
32 16 54 8 36 18 50 4 24 12 30 6 20 10 14 2
etc.
Each rightward leaning branch stays constant, because a(2n+1) = a(n).
Conjecture: Mersenne primes (A000668) gives all such odd numbers k for which a(k) = A348717(k). If true, then it immediately implies that map n -> A163511(n) [or equally: map n -> A243071(n)] has no other fixed points than those given by A007283. But see also A364959. - Edited Sep 03 2023

Crossrefs

Programs

  • PARI
    A163511(n) = if(!n,1,my(p=2, t=1); while(n>1, if(!(n%2), (t*=p), p=nextprime(1+p)); n >>= 1); (t*p));
    A348717(n) = if(1==n, 1, my(f = factor(n), k = primepi(f[1, 1])-1); for (i=1, #f~, f[i, 1] = prime(primepi(f[i, 1])-k)); factorback(f));
    A364297(n) = A348717(A163511(n));

Formula

a(0) = 1, a(1) = 2, a(2n) = A163511(2n) = 2*A163511(n), and for n > 0, a(2n+1) = a(n).

A292590 a(1) = 0; and for n > 1, a(n) = 2*a(A285712(n)) + [0 == (n mod 3)].

Original entry on oeis.org

0, 0, 1, 2, 0, 5, 10, 2, 21, 42, 4, 85, 0, 0, 171, 342, 10, 5, 684, 20, 1369, 2738, 4, 5477, 0, 42, 10955, 8, 84, 21911, 43822, 8, 21, 87644, 170, 175289, 350578, 0, 11, 701156, 0, 1402313, 40, 342, 2804627, 16, 684, 85, 5609254, 20, 11218509, 22437018, 10, 44874037, 89748074, 1368, 179496149, 168, 40, 43, 0, 2738, 1, 358992298, 5476, 717984597, 80, 8
Offset: 1

Views

Author

Antti Karttunen, Sep 20 2017

Keywords

Comments

Binary expansion of a(n) encodes the positions of multiples of three in the path taken from n to the root in the binary trees like A245612 and A244154.

Crossrefs

Programs

  • Mathematica
    f[n_] := f[n] = Which[n == 1, 0, Mod[n, 3] == 2, Ceiling[n/3], True, (Times @@ Power[If[# == 1, 1, NextPrime[#, -1]] & /@ First@ #, Last@ #] &@ Transpose@ FactorInteger[2 n - 1] + 1)/2]; a[n_] := a[n] = If[n == 1, n - 1, 2 a[f@ n] + Boole[Divisible[n, 3]]]; Array[a, 67] (* Michael De Vlieger, Sep 22 2017 *)
  • Scheme
    (define (A292590 n) (if (<= n 1) 0 (+ (if (zero? (modulo n 3)) 1 0) (* 2 (A292590 (A285712 n))))))

Formula

a(1) = 0; and for n > 1, a(n) = A079978(n) + 2*a(A285712(n)).
a(n) + A292591(n) = A245611(n).
a(A245612(n)) = A292592(n).
A000120(a(n)) = A292594(n).

A292591 a(1) = 0, a(2) = 1; and for n > 2, a(n) = 2*a(A285712(n)) + [1 == (n mod 3)].

Original entry on oeis.org

0, 1, 2, 5, 2, 10, 21, 4, 42, 85, 10, 170, 5, 4, 340, 681, 20, 8, 1363, 42, 2726, 5453, 8, 10906, 11, 84, 21812, 21, 170, 43624, 87249, 20, 40, 174499, 340, 348998, 697997, 10, 16, 1395995, 8, 2791990, 85, 680, 5583980, 43, 1362, 168, 11167961, 40, 22335922, 44671845, 16, 89343690, 178687381, 2726, 357374762, 341, 84, 80, 23, 5452, 8, 714749525, 10906
Offset: 1

Views

Author

Antti Karttunen, Sep 20 2017

Keywords

Comments

Binary expansion of a(n) encodes the positions of numbers of the form 3k+1 (with k >= 1) in the path taken from n to the root in the binary trees A245612 and A244154, except that the most significant 1-bit of a(n) always corresponds to 2 instead of 1 at the root of those trees.

Crossrefs

Programs

  • Mathematica
    f[n_] := f[n] = Which[n == 1, 0, Mod[n, 3] == 2, Ceiling[n/3], True, (Times @@ Power[If[# == 1, 1, NextPrime[#, -1]] & /@ First@ #, Last@ #] &@ Transpose@ FactorInteger[2 n - 1] + 1)/2]; a[n_] := a[n] = If[n <= 2, n - 1, 2 a[f@ n] + Boole[Mod[n, 3] == 1]]; Array[a, 65] (* Michael De Vlieger, Sep 22 2017 *)
  • Scheme
    (define (A292591 n) (if (<= n 2) (- n 1) (+ (if (= 1 (modulo n 3)) 1 0) (* 2 (A292591 (A285712 n))))))

Formula

a(n) + A292590(n) = A245611(n).
a(A245612(n)) = A292593(n).
A000120(a(n)) = A292595(n).

A305298 Restricted growth sequence transform of A291763, formed from 2-digits in ternary representation of A291763(n).

Original entry on oeis.org

1, 2, 2, 1, 2, 1, 3, 1, 2, 4, 2, 5, 6, 7, 2, 8, 2, 9, 10, 11, 2, 8, 12, 9, 13, 8, 14, 1, 2, 1, 3, 8, 2, 15, 16, 17, 18, 7, 19, 20, 2, 21, 3, 22, 23, 9, 16, 1, 24, 25, 6, 1, 12, 11, 3, 26, 2, 4, 2, 7, 6, 8, 6, 1, 2, 27, 28, 29, 30, 31, 32, 1, 33, 34, 35, 36, 37, 25, 38, 7, 2, 4, 39, 7, 6, 40, 30, 11, 32, 41, 42, 43, 30, 22, 2, 4, 19, 1, 44, 45, 13, 43, 46, 4
Offset: 0

Views

Author

Antti Karttunen, May 31 2018

Keywords

Comments

For all i, j: a(i) = a(j) => A292262(i) = A292262(j).
For all i, j: a(i) = a(j) => A305432(i) = A305432(j).

Crossrefs

Programs

  • PARI
    A003961(n) = my(f = factor(n)); for (i=1, #f~, f[i, 1] = nextprime(f[i, 1]+1)); factorback(f); \\ From A003961
    A048673(n) = (A003961(n)+1)/2;
    A254049(n) = A048673((2*n)-1);
    A245612(n) = if(n<2,1+n,if(!(n%2),(3*A245612(n/2))-1,A254049(A245612((n-1)/2))));
    A289814(n) = { my (d=digits(n, 3)); fromdigits(vector(#d, i, if (d[i]==2, 1, 0)), 2); } \\ From A289814
    A291763(n) = A289814(A245612(n));
    rgs_transform(invec) = { my(om = Map(), outvec = vector(length(invec)), u=1); for(i=1, length(invec), if(mapisdefined(om,invec[i]), my(pp = mapget(om, invec[i])); outvec[i] = outvec[pp] , mapput(om,invec[i],i); outvec[i] = u; u++ )); outvec; };
    v305298 = rgs_transform(vector(65538,n,A291763(n-1)));
    A305298(n) = v305298[1+n];

A292594 a(n) = A000120(A292590(n)).

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Sep 20 2017

Keywords

Comments

Locate the node which contains n in binary tree A245612 (or in its mirror-image A244154) and traverse from that node towards the root, counting all multiples of three that occur on the path. More formally, for n > 1, a(n) counts the multiples of 3 encountered until 1 is reached, when we iterate the map x -> A285712(x), starting from x=n. The count includes also n itself if it is a multiple of 3.

Crossrefs

Programs

  • Mathematica
    f[n_] := f[n] = Which[n == 1, 0, Mod[n, 3] == 2, Ceiling[n/3], True, (Times @@ Power[If[# == 1, 1, NextPrime[#, -1]] & /@ First@ #, Last@ #] &@ Transpose@ FactorInteger[2 n - 1] + 1)/2]; a[n_] := a[n] = If[n == 1, n - 1, 2 a[f@ n] + Boole[Divisible[n, 3]]]; Array[DigitCount[a@ #, 2, 1] &, 105] (* Michael De Vlieger, Sep 22 2017 *)

Formula

a(1) = 0; and for n > 1, a(n) = A079978(n) + a(A285712(n)).
a(n) = A000120(A292590(n)).
a(n) + A292595(n) = A285715(n).

A292595 a(n) = A000120(A292591(n)).

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Sep 20 2017

Keywords

Comments

If n > 1, then locate the node which contains n in binary tree A245612 (or in its mirror-image A244154) and traverse from that node towards the root [by iterating the map n -> A285712(n)], at the same time counting all numbers of the form 3k+1 that occur on the path, down to the final 1. This count includes also n itself if it is of the form 3k+1, with k > 0 (thus a(1) = 0).

Crossrefs

Programs

  • Scheme
    (define (A292595 n) (if (<= n 2) (- n 1) (+ (if (= 1 (modulo n 3)) 1 0) (A292595 (A285712 n)))))

Formula

a(1) = 0, a(2) = 1, and for n > 1, a(n) = a(A285712(n)) + [1 == (n mod 3)].
a(n) = A000120(A292591(n)).
a(n) + A292594(n) = A285715(n).
Previous Showing 21-30 of 30 results.