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

A137604 Consider the sequence: b(0) = n, and for k >= 1, b(k) = b(k-1)/2 if b(k-1) is even, otherwise b(k) = n - (b(k-1)+1)/2. Then a(n) = (Sum_{0<=k<=m} b(k)) - 1 for n > 1, where m is the smallest index such that b(m) = 1; a(1) = 1.

Original entry on oeis.org

1, 2, 3, 6, 7, 15, 21, 14, 15, 45, 30, 66, 63, 61, 105, 30, 31, 102, 171, 114, 93, 63, 134, 276, 258, 88, 351, 270, 105, 435, 465, 62, 63, 561, 374, 630, 126, 374, 570, 780, 547, 861, 126, 602, 204, 246, 196, 846, 537, 361, 1275, 1326, 264, 1431, 483, 990, 315
Offset: 1

Views

Author

Yasutoshi Kohmoto, Apr 23 2008

Keywords

Examples

			a(6) = 6 + 3 + 4 + 2 + 1 - 1 = 15.
		

Crossrefs

Programs

  • Mathematica
    f[1] = 1; f[n_] := Block[{lst = {n}, a}, While[a = lst[[ -1]]; a != 1, If[EvenQ@ a, AppendTo[lst, a/2], AppendTo[lst, lst[[1]] - (a + 1)/2]]]; Plus @@ lst - 1]; Array[f, 58] (* Robert G. Wilson v, May 15 2008 *)

Extensions

More terms from Robert G. Wilson v, May 15 2008

A137607 a(0)=361, a(n+1)=a(n)/2 if a(n) is even, else a(n+1)=a(0)-(a(n)+1)/2.

Original entry on oeis.org

361, 180, 90, 45, 338, 169, 276, 138, 69, 326, 163, 279, 221, 250, 125, 298, 149, 286, 143, 289, 216, 108, 54, 27, 347, 187, 267, 227, 247, 237, 242, 121, 300, 150, 75, 323, 199, 261, 230, 115, 303, 209, 256, 128, 64, 32, 16, 8, 4, 2, 1, 360, 180, 90, 45, 338, 169, 276, 138, 69, 326, 163, 279, 221, 250, 125, 298, 149, 286, 143, 289, 216, 108, 54, 27, 347, 187, 267, 227, 247, 237, 242, 121, 300, 150, 75, 323, 199, 261, 230, 115, 303, 209, 256, 128, 64, 32, 16, 8, 4, 2, 1, 360
Offset: 0

Views

Author

Yasutoshi Kohmoto, Apr 23 2008

Keywords

Comments

For n>=1, periodic with period 51. - Vladeta Jovovic, Apr 28 2008
The rule is the following: b(0)=361. If b(n-1) is divisible by 2 then b(n) = b(n-1)/2. If b(n-1) is not divisible by two then b(n) = b(0)-(b(n-1)+1)/2. It is periodic.

Crossrefs

Cf. A096259.

Programs

  • Mathematica
    NestList[If[Mod[#,2]==0,#/2,361-(#+1)/2]&,361,110] (* Harvey P. Dale, Mar 31 2024 *)
  • PARI
    A137607(n) = if( !n,361, for( i=0,n%51, n=if( i, if( n%2, 360-n\2, n\2), 360)); n) \\ M. F. Hasler, Apr 28 2008

Extensions

Clarified & extended by Vladeta Jovovic and M. F. Hasler, Apr 28 2008
The initial term, 361, seems anomalous. This sequence violates the rule that entries in the OEIS should not depend on an arbitrary but large parameter. - N. J. A. Sloane, May 17 2008

A137606 Numbers m such that all numbers {1...m} appear in the sequence {b(0) = m, b(n+1) = b(n)/2 if even, m-(b(n)+1)/2 otherwise}.

Original entry on oeis.org

1, 2, 3, 4, 6, 7, 10, 12, 15, 19, 24, 27, 30, 31, 34, 36, 40, 42, 51, 52, 54, 66, 70, 75, 82, 84, 87, 90, 91, 96, 99, 100, 106, 114, 120, 132, 135, 136, 147, 156, 159, 174, 175, 180, 184, 187, 190, 192, 195, 210, 211, 222, 231, 232, 234, 240, 244, 246, 252, 255, 262
Offset: 1

Views

Author

Yasutoshi Kohmoto, Apr 23 2008

Keywords

Comments

Lemma: A sequence {b(n)} defined as above with m>1 cannot have values outside [1,m]. (For m=1, b=(1,0,0,0....).)
Corollary: Such a sequence {b(n)} is periodic with period <= m (except maybe for some initial terms).
Lemma 2: For any m>1, b(1) = floor( m/2 ) and if b(n)=m-1, then b(n+1)= [ m/2 ].
Proposition: As soon as there is a term b(n)=2^k, the (b-)sequence continues b(n+1)=2^(k-1),...,b(n+k)=1, b(n+k+1)=m-1 and then starts over with b(n+k+2)=b(1).
Corollary 2: Numbers m=2^k, k>2 cannot appear in the present sequence.
Proposition: For any b(0)=m>1, sooner or later the value 1 is reached.
Generate a sequence b(n) by the following rule. If b(n-1) is divisible by 2 then b(n) = b(n-1)/2. If b(n-1) is not divisible by 2 then b(n) = b(0)-(b(n-1)+1)/2. When b(n)=1 it ends. Sequence gives all m such that all numbers k with 1<=k<=m-2 appear in b(n), b(0)=m.
Sequence contains 1 and numbers m>1 such that 2m-1 is prime and -2 or 2 is a primitive root modulo 2m-1. - Max Alekseyev, May 16 2008

Examples

			6->3->4->2->1. 1,2,3,4=6-2 appear in b(n), b(0)=6. So 6 is a term of A137606.
		

Crossrefs

Programs

  • Mathematica
    f[n_] := Block[{lst = {n}, a}, While[a = Last@ lst; a != 1, AppendTo[lst, If[ EvenQ@ a, a/2, lst[[1]] - (a + 1)/2]]]; Length@ lst - 1]; t = Array[f, 262]; Select[ Range @ 262, t[[ # ]] == # - 2 &] (* Robert G. Wilson v *)
  • PARI
    b137606(n)= n=[n]; for( i=1,n[1]-1, n=concat( n, if( n[i]%2, n[1]-(n[i]+1)/2, n[i]/2 )); n[i]>1 || break); n
    A137606(Nmax) = for( n=1,Nmax, n==#b137606(n) && print1(n","))
    
  • PARI
    forprime(p=3,10^3, if(znorder(Mod(-2,p))==p-1||znorder(Mod(2,p))==p-1, print1((p+1)/2,", ") )) \\ Max Alekseyev, May 16 2008

Formula

This sequence as a set is the union of { 1 }, { (A105874(n)+1)/2 } and { (A001122(n)+1)/2 }. - Max Alekseyev, May 16 2008

Extensions

Edited & extended by M. F. Hasler, Apr 28 2008
Showing 1-3 of 3 results.