[seqfan] problems with A022920
Richard J. Mathar
mathar at mpia-hd.mpg.de
Thu Aug 6 11:57:59 CEST 2015
I cannot reproduce the terms of http://oeis.org/A022920 .
Take n=8, there is the solution
7 -1 *11 -1 *13 + 1 *17 -1 *19 + 1 *23 + 1 *29 -1 *31
so a(8)=1.
Take n=10, there are the solutions
7 -1 *11 -1 *13 -1 *17 + 1 *19 + 1 *23 + 1 *29 -1 *31 + 1 *37 -1 *41;
7 -1 *11 -1 *13 + 1 *17 -1 *19 + 1 *23 -1 *29 + 1 *31 + 1 *37 -1 *41;
7 + 1 *11 -1 *13 -1 *17 -1 *19 -1 *23 + 1 *29 + 1 *31 + 1 *37 -1 *41;
7 -1 *11 -1 *13 + 1 *17 + 1 *19 -1 *23 -1 *29 + 1 *31 -1 *37 + 1 *41;
7 -1 *11 + 1 *13 -1 *17 -1 *19 + 1 *23 -1 *29 + 1 *31 -1 *37 + 1 *41;
7 -1 *11 + 1 *13 + 1 *17 -1 *19 -1 *23 -1 *29 -1 *31 + 1 *37 + 1 *41;
7 + 1 *11 -1 *13 -1 *17 + 1 *19 -1 *23 -1 *29 -1 *31 + 1 *37 + 1 *41;
so a(10)=7...
so a(12)=12...
so a(14)=61...
It a matter of taking all binary patterns with n-1 digits and checking for the 2:
# Maple
A022920 := proc(n)
local a,b,cs,cslen ;
a := 0 ;
for b from 0 to 2^(n-1)-1 do
cs := convert(b,base,2) ;
cslen := nops(cs) ;
if cslen < n-1 then
cs := [op(cs),seq(0,i=1..n-1-cslen)] ;
end if;
if ithprime(4)+add( (-1+2*op(i-4,cs)) *ithprime(i),i=5..n+3) = 2 then
printf("%d ",ithprime(4)) ;
for i from 5 to n+3 do
ci := -1+2*op(i-4,cs) ;
if ci > 0 then
printf(" + %d *%d",ci,ithprime(i)) ;
else
printf(" %d *%d",ci,ithprime(i)) ;
end if;
end do:
printf(";\n") ;
a := a+1 ;
end if;
end do:
a ;
end proc:
for n from 1 do
print(n,A022920(n)) ;
end do:
R. J. Mathar
More information about the SeqFan
mailing list