|
Search: id:A144049
|
|
|
| A144049 |
|
Number of different cycles of digits in the hexadecimal (base-16) expansions of 1/p, 2/p, ..., (p-1)/p where p = n-th prime different from 2. |
|
+0 1
|
|
| 2, 4, 2, 2, 4, 8, 2, 2, 4, 6, 4, 8, 6, 2, 4, 2, 4, 2, 2, 8, 2, 2, 8, 8, 4, 2, 2, 12, 16, 18, 2, 8, 2, 4, 10, 12, 2, 2, 4, 2, 4, 2, 8, 4, 2, 2, 6, 2, 12, 8, 2, 40, 10, 64, 2, 4, 2, 12, 8, 6, 4
(list; graph; listen)
|
|
|
OFFSET
|
1,1
|
|
|
EXAMPLE
|
For n=3, p=7. 1/7 in hexadecimal = 0.249249249... with a period of 3. (p-1)/3 = 2. a(3)=2.
|
|
PROGRAM
|
Microsoft C#.NET: public static void Main() { int b = 16; for( int n = 3; n < 300; n += 2 ) { if( !IsPrime( n ) ) { continue; } if( b % n == 0 ) { continue; } int t = 0; int x = 1; while( true ) { t++; x *= b; int d = x / n; x %= n; if( x == 1 ) { break; } } Console.Write( (double)(n-1) / t ); Console.Write(", "); } } private static bool IsPrime( int n ) { if( n % 2 == 0 ) { return false; } int test = (int)Math.Floor( Math.Sqrt( n ) ); test -= ( 1 - test % 2 ); while( test >= 3 ) { if( n % test == 0 ) { return false; } test--; } return true; }
|
|
CROSSREFS
|
A006556 for a similar sequence using decimal expansions.
Sequence in context: A013604 A021809 A117007 this_sequence A058384 A055097 A054507
Adjacent sequences: A144046 A144047 A144048 this_sequence A144050 A144051 A144052
|
|
KEYWORD
|
easy,nonn
|
|
AUTHOR
|
Phil Scovis (phildonnia(AT)yahoo.com), Sep 08 2008
|
|
|
Search completed in 0.002 seconds
|