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

A115637 In the binary expansion of n+2, transform 0->1 and 1->0 then interpret as base 4.

Original entry on oeis.org

1, 0, 5, 4, 1, 0, 21, 20, 17, 16, 5, 4, 1, 0, 85, 84, 81, 80, 69, 68, 65, 64, 21, 20, 17, 16, 5, 4, 1, 0, 341, 340, 337, 336, 325, 324, 321, 320, 277, 276, 273, 272, 261, 260, 257, 256, 85, 84, 81, 80, 69, 68, 65, 64, 21, 20, 17, 16, 5, 4, 1, 0, 1365, 1364, 1361, 1360, 1349
Offset: 0

Views

Author

Paul Barry, Jan 27 2006

Keywords

Comments

Row sums of number triangle A115636. Partial sums of A115638.
Old name was "A divide and conquer sequence".

Crossrefs

Cf. A000695, A035327, A115633, A115636, A115638 (first differences), A374625.

Programs

  • Maple
    b:= n-> 1-(n mod 2)+`if`(n<2, 0, b(iquo(n, 2))*4):
    a:= n-> b(n+2):
    seq(a(n), n=0..66);  # Alois P. Heinz, Jul 16 2024
  • Mathematica
    A115637[n_] := FromDigits[1 - IntegerDigits[n + 2, 2], 4];
    Array[A115637, 100, 0] (* Paolo Xausa, Jul 16 2024 *)
  • PARI
    up_to = 1024;
    A115633array(n, k) = (((-1)^n)*if(n==k,1, if((k+k+2)==n, -4, if((k+1)==n, -(1+(-1)^k)/2, 0))));
    A115637list(up_to) = { my(mA115633=matrix(up_to,up_to,n,k,A115633array(n-1,k-1)), mA115636 = matsolve(mA115633,matid(up_to)), v = vector(up_to)); for(n=1,up_to,v[n] = vecsum(mA115636[n,])); (v); };
    v115637 = A115637list(up_to+1);
    A115637(n) = v115637[1+n]; \\ Antti Karttunen, Nov 02 2018
    
  • PARI
    a(n) = fromdigits([!b |b<-binary(n+2)], 4); \\ Kevin Ryde, Jul 15 2024
    
  • Python
    def A115637(n): return int(bin((~(n+2))^(-1<<(n+2).bit_length()))[2:],4) # Chai Wah Wu, Jul 17 2024

Formula

G.f.: (1/(1-x))*Sum_{k>=0} 4^k*x^(2^(k+1)-2)/(1+x^(2^k)); the g.f. G(x) satisfies G(x) - 4(1+x)*x^2*G(x^2) = 1/(1-x^2).
a(n) = A000695(A035327(n+2)). - Kevin Ryde, Jul 15 2024

Extensions

New name from Kevin Ryde, Jul 15 2024

A359219 Starting numbers that require more iterations of the map x->A359194(x) (binary complement of 3n) to reach 0 than any smaller number.

Original entry on oeis.org

0, 1, 2, 3, 4, 9, 11, 12, 17, 23, 28, 33, 74, 86, 180, 227, 350, 821, 3822, 4187, 5561, 6380, 6398, 22174, 22246, 26494, 34859, 49827, 70772, 103721, 104282, 204953, 213884, 225095, 407354, 425720
Offset: 1

Views

Author

Joshua Searle, Dec 21 2022

Keywords

Comments

425720 after 10^10 iterations has not yet reached 0 and in general it is unknown whether every starting number does reach 0.
A359207(425720) = 87037147316. - Martin Ehrenstein, Jan 02 2023

Examples

			3 is a term because it requires 11 iterations to reach 0, which is more than any starting number less than 3.
0: (0) -- 0 terms
1: (1, 0) -- 1 term
2: (2, 1, 0) -- 2 terms
3: (3, 6, 13, 24, 55, 90, 241, 300, 123, 142, 85, 0) -- 11 terms.
		

Crossrefs

Programs

  • Python
    from itertools import count, islice
    def f(n): return 1 if n == 0 else (m:=3*n)^((1 << m.bit_length())-1)
    def iters(n):
        i, fi = 0, n
        while fi != 0: i, fi = i+1, f(fi)
        return i
    def agen(): # generator of terms
        record = -1
        for m in count(0):
            v = iters(m)
            if v > record: yield m; record = v
    print(list(islice(agen(), 18))) # Michael S. Branicky, Dec 21 2022

Extensions

a(27)-a(36) from Tom Duff (SeqFan mailing list, Dec 19 2022)

A359220 Number of steps to reach 0 from A359219(n) where A359219 are the starting numbers that require more iterations in the map x->A359194(x) than any smaller number.

Original entry on oeis.org

0, 1, 2, 11, 12, 13, 19, 80, 81, 83, 7572, 7573, 7574, 7578, 7580, 664475, 664882, 3180929, 3180930, 3180931, 3181981, 3181988, 3182002, 3182226, 120796790, 556068798, 556068799, 556068871, 556068872, 572086553, 572086610, 1246707529, 1246707552, 1246707555, 1246707602
Offset: 1

Views

Author

Joshua Searle, Dec 21 2022

Keywords

Comments

It is unknown whether all starting numbers reach 0; the next term, a(36) depends on whether 425720 ever reaches 0 (see A359207). It remains nonzero after 10^10 iterations.
A359207(425720) = 87037147316. Calculated by Tom Duff (12/16/22) - Joshua Searle, Jan 10 2023
a(4) - a(7) only differ by a small fraction of their starting terms. The same is true for the terms in the intervals a(8) - a(10), a(11) - a(15), a(16) - a(17) and a(18) - a(24). It may also be true for a(26) - a(29), a(30) - a(31) and a(32) - a(35).

Examples

			a(4) is the step count from the starting number A359219(4) = 3: (3, 6, 13, 24, 55, 90, 241, 300, 123, 142, 85, 0) -- 11 steps, hence a(4) = 11.
		

Crossrefs

Programs

  • Python
    from itertools import count, islice
    def f(n): return 1 if n == 0 else (m:=3*n)^((1 << m.bit_length())-1)
    def iters(n):
        i, fi = 0, n
        while fi != 0: i, fi = i+1, f(fi)
        return i
    def agen(): # generator of terms
        record = -1
        for m in count(0):
            v = iters(m)
            if v > record: yield v; record = v
    print(list(islice(agen(), 18))) # Michael S. Branicky, Dec 21 2022

Extensions

a(27) and beyond from Tom Duff (SeqFan mailing list, Dec 19 2022)

A359221 Starting numbers which reach a new record high value when iterating the map x->A359194(x) (binary complement of 3n).

Original entry on oeis.org

0, 1, 2, 3, 12, 28, 227, 821, 22246, 26494, 204953, 425720
Offset: 1

Views

Author

Joshua Searle, Dec 22 2022

Keywords

Comments

It is unknown whether all starting numbers reach 0.
103721 is not a term of this sequence despite having a trajectory of record length, because its maximum of 2.42...*10^14081 is lower than the previous record holder.

Examples

			Let S(x) = iteration sequence of A359194 starting with x; then
S(0) = (0), maximum = 0;
S(1) = (1, 0), maximum = 1;
S(2) = (2, 1, 0), maximum = 2;
S(3) = (3, 6, 13, 24, 55, 90, 241, 300, 123, 142, 85, 0), maximum = 300;
Since S(3) contains a higher maximum than any lower positive starting integer, 3 is a term of this sequence.
		

Crossrefs

Programs

  • Python
    from itertools import count, islice
    def f(n): return 1 if n == 0 else (m:=3*n)^((1 << m.bit_length())-1)
    def itersmax(n):
        i, fi, m = 0, n, n
        while fi != 0: i, fi, m = i+1, f(fi), max(m, fi)
        return i, m
    def agen(): # generator of terms
        record = -1
        for m in count(0):
            v, mx = itersmax(m)
            if mx > record:
                yield m # use mx to obtain values
                record = mx
    print(list(islice(agen(), 8))) # Michael S. Branicky, Dec 22 2022

A097326 Largest integer m such that m*n has the same decimal digit length as n.

Original entry on oeis.org

9, 4, 3, 2, 1, 1, 1, 1, 1, 9, 9, 8, 7, 7, 6, 6, 5, 5, 5, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 9, 9, 9, 9, 9, 9
Offset: 1

Views

Author

Rick L. Shepherd, Aug 04 2004

Keywords

Comments

For any positive base B >= 2 the corresponding sequence contains only terms from 1 to B-1 inclusive so the corresponding sequence for binary is all 1's (A000012).

Examples

			a(12)=8 as 12 and 8*12=96 both have two decimal digits while 9*12=108 has three.
		

Crossrefs

Cf. A061601 (analog for decimal m+n), A035327 (analog for binary m+n), A097327.
Cf. A055642.

Programs

  • Mathematica
    limn[n_]:=Module[{k=9,len=IntegerLength[n]},While[IntegerLength[k*n] > len, k--];k]; Array[limn,110] (* Harvey P. Dale, Apr 28 2018 *)
    Table[Ceiling[10^IntegerLength[n]/n] - 1, {n, 100}] (* Paolo Xausa, Nov 06 2024 *)
  • PARI
    a(n) = my(m=1, sn=#Str(n)); while (#Str(m*n) <= sn, m++); m-1; \\ Michel Marcus, Oct 05 2021
  • Python
    def a(n): return (10**len(str(n))-1)//n
    print([a(n) for n in range(1, 106)]) # Michael S. Branicky, Oct 05 2021
    

Formula

a(n) = A097327(n) - 1.
a(n) = floor((10^A055642(n) - 1)/n). - Michael S. Branicky, Oct 05 2021

A145382 Write the n-th prime in binary. Change all 0's to 1's and all 1's to 0's. a(n) is the decimal equivalent of the result.

Original entry on oeis.org

1, 0, 2, 0, 4, 2, 14, 12, 8, 2, 0, 26, 22, 20, 16, 10, 4, 2, 60, 56, 54, 48, 44, 38, 30, 26, 24, 20, 18, 14, 0, 124, 118, 116, 106, 104, 98, 92, 88, 82, 76, 74, 64, 62, 58, 56, 44, 32, 28, 26, 22, 16, 14, 4, 254, 248, 242, 240, 234, 230, 228, 218, 204, 200, 198, 194, 180, 174
Offset: 1

Views

Author

Leroy Quet, Oct 09 2008

Keywords

Comments

a(n) = A035327(p(n)), where p(n) is the n-th prime.

Crossrefs

A171008 gives the binary expansions. Cf. A035327.

Programs

  • Maple
    f:=proc(n) options operator, arrow: 2^(1+floor(log[2](n)))-n-1 end proc: seq(f(ithprime(n)),n=1..71); # Emeric Deutsch, Oct 19 2008

Formula

a(n)=2^{1+floor(log[2](p(n)))}-n-1, where p(n) is the n-th prime. - Emeric Deutsch, Oct 19 2008

Extensions

Extended by Emeric Deutsch, Oct 19 2008

A256294 Apply the transformation 0 -> 1 -> 2 -> 3 -> 0 to the digits of n written in base 4, then convert back to base 10.

Original entry on oeis.org

1, 2, 3, 0, 9, 10, 11, 8, 13, 14, 15, 12, 1, 2, 3, 0, 37, 38, 39, 36, 41, 42, 43, 40, 45, 46, 47, 44, 33, 34, 35, 32, 53, 54, 55, 52, 57, 58, 59, 56, 61, 62, 63, 60, 49, 50, 51, 48, 5, 6, 7, 4, 9, 10, 11, 8, 13, 14, 15, 12
Offset: 0

Views

Author

M. F. Hasler, Mar 22 2015

Keywords

Comments

Base 4 variant of A035327 (base 2) and A048379 (base 10). See A256293 - A256299 for bases 3 through 9, and A256304 for the variant where the result is not converted back to base 10.

Examples

			a(4) = 7 because 4 = 10[4] becomes 21[4] = 9.
a(15) = 0 because 15 = 33[4] becomes 00[4] = 0.
		

Programs

  • PARI
    A256294(n,b=4)=!n+apply(t->(t+1)%b,n=digits(n,b))*vector(#n,i,b^(#n-i))~

A256298 Apply the transformation 0 -> 1 -> 2 -> 3 -> 4 -> 5 -> 6 -> 7 -> 0 to the digits of n written in base 8, then convert back to base 10.

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 7, 0, 17, 18, 19, 20, 21, 22, 23, 16, 25, 26, 27, 28, 29, 30, 31, 24, 33, 34, 35, 36, 37, 38, 39, 32, 41, 42, 43, 44, 45, 46, 47, 40, 49, 50, 51, 52, 53, 54, 55, 48, 57, 58, 59, 60, 61, 62, 63, 56, 1, 2, 3, 4
Offset: 0

Views

Author

M. F. Hasler, Mar 22 2015

Keywords

Comments

Base 8 variant of A035327 (base 2) and A048379 (base 10). See A256293 - A256299 for bases 3 through 9, and A256308 for the variant where the result is not converted back to base 10.

Examples

			a(8) = 17 because 8 = 10[8] becomes 21[8] = 17.
a(63) = 0 because 63 = 77[8] becomes 00[8] = 0.
		

Programs

  • Mathematica
    Table[FromDigits[IntegerDigits[n,8]+1/.(8->0),8],{n,0,60}] (* Harvey P. Dale, Jan 28 2023 *)
  • PARI
    A256298(n,b=8)=!n+apply(t->(t+1)%b,n=digits(n,b))*vector(#n,i,b^(#n-i))~

A359222 Number of steps to reach 0 from A359221(n) (Starting numbers that reach a new record high value during iteration by the map x->A359194(x)).

Original entry on oeis.org

0, 1, 2, 11, 80, 7572, 664475, 3180929, 120796790, 556068798, 1246707529, 87037147316
Offset: 1

Views

Author

Joshua Searle, Dec 29 2022

Keywords

Comments

a(12) found by Tom Duff (26 Dec 2022).
It is unknown whether all starting numbers reach 0.

Examples

			a(4) is the step count from the starting number A359221(4) = 3: (3, 6, 13, 24, 55, 90, 241, 300, 123, 142, 85, 0) -- 11 steps, hence a(4) = 11.
		

Crossrefs

Programs

  • Python
    from itertools import count, islice
    def f(n): return 1 if n == 0 else (m:=3*n)^((1 << m.bit_length())-1)
    def itersmax(n):
        i, fi, m = 0, n, n
        while fi != 0: i, fi, m = i+1, f(fi), max(m, fi)
        return i, m
    def agen(): # generator of terms
        record = -1
        for m in count(0):
            v, mx = itersmax(m)
            if mx > record:
                yield v # use m to obtain starting numbers
                record = mx
    print(list(islice(agen(), 8))) # Michael S. Branicky, Dec 29 2022

A359303 Bitwise encoding of the state of a 1D cellular automaton after n steps from ...111000... where adjacent cells swap 01 <-> 10 when within triples 110 or 011.

Original entry on oeis.org

1, 3, 5, 11, 13, 39, 43, 45, 103, 155, 171, 173, 359, 411, 619, 669, 1367, 1371, 1387, 1437, 3287, 4923, 5339, 5467, 5483, 5533, 11479, 13115, 19675, 21339, 21739, 21853, 43735, 43835, 44251, 45915, 52459, 78685, 170455, 173755, 174555, 174811, 174939, 175339, 176989, 367063, 419515, 629211
Offset: 1

Views

Author

Raphael J. F. Berger, Dec 25 2022

Keywords

Comments

This automaton is a toy model for diffusion. It is inspired by the "Unstable Diffusion" problem encountered on day 23 of the "Advent of Code 2022" challenge and it serves as a 1D counterpart to the 2D cellular automaton featured there.
The state is a bi-infinite string of 1's and 0's of the form ...1111 middle 0000...
The state is encoded in an integer by discarding the left infinite 1's and one 0 which follows, then interpret the rest left-to-right as binary least- to most-significant bit.
The state steps by locating all cells which will swap, and applying those swaps simultaneously.
In pattern 110, the 10 cells swap to become 01, and conversely in pattern 011 the 01 cells swap to become 10.
Patterns can overlap so that, for example, 0110 is an 011 and a 110 and the two swaps step to 1001.
Swaps conflict in a pattern 11011 since they try to swap the 0 both to the left and to the right. When this happens, neither of these conflicting swaps are applied.
At least one swap always occurs since the rightmost 11 pair is followed by 0 and this 110 has no further 11 after which would conflict.
The total number of 1's and 0's is preserved in each state (when taking some large enough part of the bi-infinite state).

Examples

			For n=1, the starting state steps by a single swap, marked (), and the resulting string excluding left ...1110 is the bits of a(1) = 1,
  start      ...11110000...
                   ()
  a(1) = 1 = ...11101000...
                    \---> bits 100...
Conflicting swaps are seen at n=2 in pattern 11011. Its 101 is unchanged, but the right 11 is also part of a 110 and it does swap,
  a(2) = 3 = ...11110110000...
                   CCC()
  a(3) = 5 = ...11110101000...
                     \---> bits 101... = 5
Bit encoding direction, least- to most-significant, is seen at n=5,
  a(5) = 13 = ...1111010110000...
                      \--->  bits 1011
Overlapping swaps in pattern 0110 are seen at n=8,
  a(8) = 45 =   ...111101011010000...
                      () ()()
  a(9) = 103 = ...1111011100110000...
		

Crossrefs

Programs

  • Mathematica
    ClearAll[{s,prop,checkprop,doprop,run,p,pa,a,j}];
    prop[s_]:=(p=Array[0#&,Length[s]];
    Do[If[i==1 ||i==Length[s],p[[i]]=0,
       {p[[i-1]],p[[i]],p[[i+1]]}+=
      Piecewise[{{{1,-1,0},{s[[i-1]],s[[i]],s[[i+1]]}=={0,1,1}},
                            {{0,-1,1},{s[[i-1]],s[[i]],s[[i+1]]}=={1,1,0}}},{0,0,0}]],{i,1,Length[s]-1} ];
                                      Return[p])
    checkprop[s_]:=(p=s;
                                              Do[If[p[[i]]==2,{p[[i-1]],p[[i]],p[[i+1]]}={0,0,0}],{i,2,Length[s]-1}];
                                              Return[p])
    doprop[s_]:= Return[s +checkprop[prop[s]]]
    (* the cellular automaton starting with n+5 "1" cells and n+5 "0" cells *)
    run[n_]:=( s=Join[Array[#/#&,n+5],Array[0#&,n+5]] ;Table[Nest[doprop[#]&,s,k],{k,0,n}])
    (*conversion from the automaton states to integers *)
    (* a[10] returns {1,3,5,11,13,39,43,45,103} *)
    a[j_]:=Table[FromDigits[Reverse[run[j+1][[k,All]]/.{Longest[1 ...], x___} :> {x}],2]/2,{k,2,j+1}]
  • PARI
    \\ See links.

Formula

a(n) = A030101(A035327(A360142(n))) + A360141(n) * A062383(A035327(A360142(n))), being reconstruction from left half (A360141) and right half (A360142). - Raphael J. F. Berger, Jun 21 2023
Previous Showing 41-50 of 74 results. Next