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!)
A213407 First occurrence of n in A213381. 2

%I #16 Jan 31 2014 09:49:30

%S 2,0,3,5,4,9,8,7,12,17,594270126787,21,20,13,24,29,16,23,32,19,36,41,

%T 1356,45,38,151,51,411,994,57,56,31,60,65,52,69,71,37,72,77,490,81,80,

%U 169,84,6125,68,1043,92,49,99,101,304,105,104,55,111,63,73,89,116,61,120,125,78,129,188,67,93,137,97,18349355,140,433

%N First occurrence of n in A213381.

%F a(n) = smallest k>n such that (-2)^k == n (mod k+2).

%e Smallest n such that A213381(n)=9 is 17, so a(9)=17.

%o (C)

%o #include <stdio.h> // GCC -O3 -fopenmp

%o #include <omp.h> // 11 minutes

%o #define SIZE 4096

%o #define STEP 0x1000000

%o long long first[SIZE];

%o int main(int argc, char **argv)

%o {

%o unsigned long long a, i;

%o for (a=0; a<SIZE; ++a) first[a]=-1LL;

%o omp_set_num_threads(4);

%o for (i=STEP; i<=0x100000000; i+=STEP) {

%o #pragma omp parallel for schedule(static,STEP/4)

%o for (a=i-STEP; a<i; ++a) {

%o unsigned long long b, r, p, t;

%o for (b=a+2, r=1, p=t=a; t>0; p=(p*p)%b, t>>=1) {

%o if (t&1) r=(r*p)%b;

%o }

%o if (r<SIZE) { if (a<(unsigned)first[r]) first[r]=a; }

%o }

%o printf("\n%llx : ", i);

%o for (a=0; a<SIZE; ++a) if (first[a]==-1LL) printf("%llu ", a);

%o }

%o printf("\n\n");

%o for (a=0; a<500; ++a) printf("%lld, ", first[a]);

%o }

%Y Cf. A213381, A213861

%K nonn

%O 0,1

%A _Alex Ratushnyak_, Jun 10 2012

%E Terms a(10) onward from _Max Alekseyev_, Jan 31 2014

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 August 3 17:10 EDT 2024. Contains 374895 sequences. (Running on oeis4.)