A337123 a(n) is the number of primes p in the n-digit "signed nonadjacent form" such that p has 3 or fewer nonzero digits.
0, 1, 2, 1, 4, 5, 7, 5, 9, 8, 12, 7, 11, 7, 11, 9, 14, 10, 18, 11, 21, 7, 9, 11, 16, 4, 8, 9, 7, 12, 18, 13, 14, 11, 10, 9, 18, 7, 12, 10, 18, 12, 22, 5, 11, 13, 16, 13, 22, 8, 9, 16, 13, 9, 13, 14, 10, 11, 10, 10, 20, 15, 9, 10, 13, 8, 22, 10, 10, 10, 12, 13
Offset: 1
Examples
There is only one number in single-digit SNF notation, which is 1 and 1 is not a prime. So a(1)=0; There is only one number in the two-digit SNF notation, which is 10 = 2 base 10 and it is a prime with one nonzero digit. So a(2)=1; There are three numbers in three digits SNF notation: 10T = 3 base 10, 100 = 4 base 10, and 101 = 5 base 10. There are two prime numbers among 3, 4, and 5 and both of them have two nonzero digits. So a(3)=2; ... For seven-digit SNF numbers, 10T0T0T = 43 base 10 has 4 nonzero digits (excluded); 10T000T = 47 base 10 has 3 nonzero digits (included). Thereafter 10T0101 = 53: 4 digits, excluded; 1000T0T = 59: 3 digits, included; 1000T01 = 61: 3 digits, included; 100010T = 67: 3 digits, included; 100100T = 71: 3 digits, included; 1001001 = 73, 3 digits, included; 101000T = 79: 3 digits, included; 101010T = 83, 4 digits, excluded. In total, 7 numbers fit the definition. So a(7)=7.
References
- Joerg Arndt, Matters Computational - Ideas, Algorithms, Source Code, 2011, Springer, pp. 61-62.
Links
- H. Prodinger, On binary representations of integers with digits -1,0,1, Integers 0 (2000), #A08.
Programs
-
Mathematica
Table[s1=2^(n-1);ct=0; If[n>1, If[PrimeQ[s1+1],ct++]; If[PrimeQ[s1-1],ct++]; If[n>=5, Do[s2=2^i; If[PrimeQ[s1+s2+1],ct++]; If[PrimeQ[s1+s2-1],ct++]; If[PrimeQ[s1-s2+1],ct++]; If[PrimeQ[s1-s2-1],ct++], {i,2,n-3}]]]; ct, {n,1,72}]
Comments