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}.
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
Keywords
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.
Links
- Robert G. Wilson v, Table of n, a(n) for n = 1..2354.
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
Comments