login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
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

%I #7 Oct 13 2013 03:03:08

%S 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,

%T 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

%N 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.

%e For n=3, p=7. 1/7 in hexadecimal = 0.249249249... with a period of 3. (p-1)/3 = 2. a(3)=2.

%o (C#.NET)

%o 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; }

%Y A006556 for a similar sequence using decimal expansions.

%K easy,nonn,base

%O 1,1

%A _Phil Scovis_, Sep 08 2008

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 25 13:02 EDT 2024. Contains 371969 sequences. (Running on oeis4.)