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.

A213407 First occurrence of n in A213381.

This page as a plain text file.
%I A213407 #16 Jan 31 2014 09:49:30
%S A213407 2,0,3,5,4,9,8,7,12,17,594270126787,21,20,13,24,29,16,23,32,19,36,41,
%T A213407 1356,45,38,151,51,411,994,57,56,31,60,65,52,69,71,37,72,77,490,81,80,
%U A213407 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 A213407 First occurrence of n in A213381.
%F A213407 a(n) = smallest k>n such that (-2)^k == n (mod k+2).
%e A213407 Smallest n such that A213381(n)=9 is 17, so a(9)=17.
%o A213407 (C)
%o A213407 #include <stdio.h> // GCC -O3 -fopenmp
%o A213407 #include <omp.h>  // 11 minutes
%o A213407 #define SIZE 4096
%o A213407 #define STEP 0x1000000
%o A213407 long long first[SIZE];
%o A213407 int main(int argc, char **argv)
%o A213407 {
%o A213407     unsigned long long a, i;
%o A213407     for (a=0; a<SIZE; ++a)  first[a]=-1LL;
%o A213407     omp_set_num_threads(4);
%o A213407     for (i=STEP; i<=0x100000000; i+=STEP) {
%o A213407       #pragma omp parallel for schedule(static,STEP/4)
%o A213407       for (a=i-STEP; a<i; ++a) {
%o A213407         unsigned long long b, r, p, t;
%o A213407         for (b=a+2, r=1, p=t=a; t>0; p=(p*p)%b, t>>=1) {
%o A213407             if (t&1) r=(r*p)%b;
%o A213407         }
%o A213407         if (r<SIZE)  { if (a<(unsigned)first[r]) first[r]=a; }
%o A213407       }
%o A213407       printf("\n%llx : ", i);
%o A213407       for (a=0; a<SIZE; ++a)  if (first[a]==-1LL) printf("%llu ", a);
%o A213407     }
%o A213407     printf("\n\n");
%o A213407     for (a=0; a<500; ++a)  printf("%lld, ", first[a]);
%o A213407 }
%Y A213407 Cf. A213381, A213861
%K A213407 nonn
%O A213407 0,1
%A A213407 _Alex Ratushnyak_, Jun 10 2012
%E A213407 Terms a(10) onward from _Max Alekseyev_, Jan 31 2014